diff --git a/core/modules/hal/tests/src/Kernel/NormalizeTest.php b/core/modules/hal/tests/src/Kernel/NormalizeTest.php index e77d4b464a..d837b79a02 100644 --- a/core/modules/hal/tests/src/Kernel/NormalizeTest.php +++ b/core/modules/hal/tests/src/Kernel/NormalizeTest.php @@ -5,7 +5,6 @@ use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Url; use Drupal\entity_test\Entity\EntityTest; -use Drupal\filter\Entity\FilterFormat; /** * Tests HAL normalization edge cases for EntityResource. @@ -19,28 +18,6 @@ class NormalizeTest extends NormalizerTestBase { */ protected function setUp() { parent::setUp(); - // Create a text format because it is needed for TextItemBase normalization. - // @see \Drupal\text\Normalizer\TextItemBaseNormalizer::normalize(). - FilterFormat::create([ - 'format' => 'my_text_format', - 'name' => 'My Text Format', - 'filters' => [ - 'filter_html' => [ - 'module' => 'filter', - 'status' => TRUE, - 'weight' => 10, - 'settings' => [ - 'allowed_html' => '

', - ], - ], - 'filter_autop' => [ - 'module' => 'filter', - 'status' => TRUE, - 'weight' => 10, - 'settings' => [], - ], - ], - ])->save(); \Drupal::service('router.builder')->rebuild(); } @@ -60,7 +37,7 @@ public function testNormalize() { 'name' => $this->randomMachineName(), 'field_test_text' => [ 'value' => $this->randomMachineName(), - 'format' => 'my_text_format', + 'format' => 'full_html', ], 'field_test_entity_reference' => [ 'target_id' => $target_entity_de->id(), @@ -175,7 +152,6 @@ public function testNormalize() { [ 'value' => $values['field_test_text']['value'], 'format' => $values['field_test_text']['format'], - 'process_result' => "

{$values['field_test_text']['value']}

", ], ], ]; diff --git a/core/modules/rest/tests/src/Functional/EntityResource/Comment/CommentResourceTestBase.php b/core/modules/rest/tests/src/Functional/EntityResource/Comment/CommentResourceTestBase.php index d3de35e771..7b65c848b7 100644 --- a/core/modules/rest/tests/src/Functional/EntityResource/Comment/CommentResourceTestBase.php +++ b/core/modules/rest/tests/src/Functional/EntityResource/Comment/CommentResourceTestBase.php @@ -5,7 +5,6 @@ use Drupal\comment\Entity\Comment; use Drupal\comment\Entity\CommentType; use Drupal\comment\Tests\CommentTestTrait; -use Drupal\Core\Cache\Cache; use Drupal\entity_test\Entity\EntityTest; use Drupal\Tests\rest\Functional\BcTimestampNormalizerUnixTestTrait; use Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase; @@ -198,7 +197,6 @@ protected function getExpectedNormalizedEntity() { [ 'value' => 'The name "llama" was adopted by European settlers from native Peruvians.', 'format' => 'plain_text', - 'process_result' => '

The name "llama" was adopted by European settlers from native Peruvians.

' . "\n", ], ], ]; @@ -251,20 +249,6 @@ protected function getNormalizedPatchEntity() { } /** - * {@inheritdoc} - */ - protected function getExpectedCacheTags() { - return Cache::mergeTags(parent::getExpectedCacheTags(), ['config:filter.format.plain_text']); - } - - /** - * {@inheritdoc} - */ - protected function getExpectedCacheContexts() { - return Cache::mergeContexts(['languages:language_interface', 'theme'], parent::getExpectedCacheContexts()); - } - - /** * Tests POSTing a comment without critical base fields. * * testPost() is testing with the most minimal normalization possible: the one diff --git a/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php b/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php index 6cdcf2bf2d..277c47042b 100644 --- a/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php +++ b/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php @@ -465,7 +465,7 @@ public function testGet() { // for the keys with the array order the same (it needs to match with // identical comparison). $expected = $this->getExpectedNormalizedEntity(); - static::recursiveKSort($actual); + static::recursiveKSort($expected); $actual = $this->serializer->decode((string) $response->getBody(), static::$format); static::recursiveKSort($actual); $this->assertSame($expected, $actual); @@ -530,7 +530,7 @@ public function testGet() { // Config entities are not affected. // @see \Drupal\serialization\Normalizer\ConfigEntityNormalizer::normalize() $expected = static::castToString($expected); - static::recursiveKSort($actual); + static::recursiveKSort($expected); $actual = $this->serializer->decode((string) $response->getBody(), static::$format); static::recursiveKSort($actual); $this->assertSame($expected, $actual); diff --git a/core/modules/rest/tests/src/Functional/EntityResource/Term/TermResourceTestBase.php b/core/modules/rest/tests/src/Functional/EntityResource/Term/TermResourceTestBase.php index 5d5d030c38..cdf446823e 100644 --- a/core/modules/rest/tests/src/Functional/EntityResource/Term/TermResourceTestBase.php +++ b/core/modules/rest/tests/src/Functional/EntityResource/Term/TermResourceTestBase.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\rest\Functional\EntityResource\Term; -use Drupal\Core\Cache\Cache; use Drupal\taxonomy\Entity\Term; use Drupal\taxonomy\Entity\Vocabulary; use Drupal\Tests\rest\Functional\BcTimestampNormalizerUnixTestTrait; @@ -72,7 +71,6 @@ protected function createEntity() { // Create a "Llama" taxonomy term. $term = Term::create(['vid' => $vocabulary->id()]) ->setName('Llama') - ->setDescription("It is a little known fact that llamas cannot count higher the seven.") ->setChangedTime(123456789) ->set('path', '/llama'); $term->save(); @@ -103,9 +101,8 @@ protected function getExpectedNormalizedEntity() { ], 'description' => [ [ - 'value' => 'It is a little known fact that llamas cannot count higher the seven.', + 'value' => NULL, 'format' => NULL, - 'process_result' => "

It is a little known fact that llamas cannot count higher the seven.

\n", ], ], 'parent' => [], @@ -175,18 +172,4 @@ protected function getExpectedUnauthorizedAccessMessage($method) { } } - /** - * {@inheritdoc} - */ - protected function getExpectedCacheTags() { - return Cache::mergeTags(parent::getExpectedCacheTags(), ['config:filter.format.plain_text', 'config:filter.settings']); - } - - /** - * {@inheritdoc} - */ - protected function getExpectedCacheContexts() { - return Cache::mergeContexts(['url.site'], $this->container->getParameter('renderer.config')['required_cache_contexts']); - } - } diff --git a/core/modules/serialization/tests/modules/field_normalization_test/field_normalization_test.services.yml b/core/modules/serialization/tests/modules/field_normalization_test/field_normalization_test.services.yml index 51fdd4a5fa..36243e7954 100644 --- a/core/modules/serialization/tests/modules/field_normalization_test/field_normalization_test.services.yml +++ b/core/modules/serialization/tests/modules/field_normalization_test/field_normalization_test.services.yml @@ -2,5 +2,5 @@ services: serializer.normalizer.silly_fielditem: class: Drupal\field_normalization_test\Normalization\TextItemSillyNormalizer tags: - # The priority must be higher than serializer.normalizer.text_item_base. - - { name: normalizer , priority: 30 } + # The priority must be higher than serialization.normalizer.field_item. + - { name: normalizer , priority: 9 } diff --git a/core/modules/serialization/tests/src/Kernel/EntitySerializationTest.php b/core/modules/serialization/tests/src/Kernel/EntitySerializationTest.php index ac676fc0f0..ebd4e03317 100644 --- a/core/modules/serialization/tests/src/Kernel/EntitySerializationTest.php +++ b/core/modules/serialization/tests/src/Kernel/EntitySerializationTest.php @@ -2,10 +2,8 @@ namespace Drupal\Tests\serialization\Kernel; -use Drupal\Component\Serialization\Json; use Drupal\Component\Utility\SafeMarkup; use Drupal\entity_test\Entity\EntityTestMulRev; -use Drupal\filter\Entity\FilterFormat; use Drupal\Tests\rest\Functional\BcTimestampNormalizerUnixTestTrait; /** @@ -65,29 +63,6 @@ protected function setUp() { // User create needs sequence table. $this->installSchema('system', ['sequences']); - // Create a text format because it is needed for TextItemBase normalization. - // @see \Drupal\text\Normalizer\TextItemBaseNormalizer::normalize(). - FilterFormat::create([ - 'format' => 'my_text_format', - 'name' => 'My Text Format', - 'filters' => [ - 'filter_html' => [ - 'module' => 'filter', - 'status' => TRUE, - 'weight' => 10, - 'settings' => [ - 'allowed_html' => '

', - ], - ], - 'filter_autop' => [ - 'module' => 'filter', - 'status' => TRUE, - 'weight' => 10, - 'settings' => [], - ], - ], - ])->save(); - // Create a test user to use as the entity owner. $this->user = \Drupal::entityManager()->getStorage('user')->create([ 'name' => 'serialization_test_user', @@ -97,13 +72,12 @@ protected function setUp() { $this->user->save(); // Create a test entity to serialize. - $test_text_value = $this->randomMachineName(); $this->values = [ 'name' => $this->randomMachineName(), 'user_id' => $this->user->id(), 'field_test_text' => [ - 'value' => $test_text_value, - 'format' => 'my_text_format', + 'value' => $this->randomMachineName(), + 'format' => 'full_html', ], ]; $this->entity = EntityTestMulRev::create($this->values); @@ -157,7 +131,6 @@ public function testNormalize() { [ 'value' => $this->values['field_test_text']['value'], 'format' => $this->values['field_test_text']['format'], - 'process_result' => "

{$this->values['field_test_text']['value']}

", ], ], ]; @@ -198,7 +171,7 @@ public function testSerialize() { // JsonEncoder. The output of ComplexDataNormalizer::normalize() is tested // elsewhere, so we can just assume that it works properly here. $normalized = $this->serializer->normalize($this->entity, 'json'); - $expected = Json::encode($normalized); + $expected = json_encode($normalized); // Test 'json'. $actual = $this->serializer->serialize($this->entity, 'json'); $this->assertIdentical($actual, $expected, 'Entity serializes to JSON when "json" is requested.'); @@ -225,7 +198,7 @@ public function testSerialize() { 'revision_id' => '' . $this->entity->getRevisionId() . '', 'default_langcode' => '1', 'non_rev_field' => '', - 'field_test_text' => '' . $this->values['field_test_text']['value'] . '' . $this->values['field_test_text']['format'] . '' . $this->values['field_test_text']['value'] . '

]]>
', + 'field_test_text' => '' . $this->values['field_test_text']['value'] . '' . $this->values['field_test_text']['format'] . '', ]; // Sort it in the same order as normalised. $expected = array_merge($normalized, $expected);