ContentEntityNormalizerAlterTest.php in Replication 8
File
tests/src/Kernel/Normalizer/ContentEntityNormalizerAlterTest.php
View source
<?php
namespace Drupal\Tests\replication\Kernel\Normalizer;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\entity_test\Entity\EntityTestMulRev;
class ContentEntityNormalizerAlterTest extends NormalizerTestBase {
public static $modules = [
'serialization',
'multiversion',
'key_value',
'system',
'field',
'entity_test',
'replication',
'text',
'filter',
'user',
'replication_alter_test',
];
protected $entityClass = EntityTest::class;
protected function setUp() {
parent::setUp();
$this->values = [
'name' => $this
->randomMachineName(),
'user_id' => 1,
'field_test_text' => [
'value' => $this
->randomMachineName(),
'format' => 'full_html',
],
];
$this->entity = EntityTestMulRev::create($this->values);
$this->entity
->save();
}
public function testNormalizerAlterEvent() {
$normalized = $this->serializer
->normalize($this->entity);
$this
->assertSame([
'foo' => 'bar',
], $normalized['_test']);
}
}