tests/src/Functional/EntityTestTest.php | 7 ++++++- tests/src/Functional/NodeTest.php | 7 ++++++- tests/src/Functional/TermTest.php | 13 +++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/tests/src/Functional/EntityTestTest.php b/tests/src/Functional/EntityTestTest.php index 86ccb42..87fe639 100644 --- a/tests/src/Functional/EntityTestTest.php +++ b/tests/src/Functional/EntityTestTest.php @@ -94,7 +94,7 @@ class EntityTestTest extends ResourceTestBase { protected function getExpectedNormalizedEntity() { $self_url = Url::fromUri('base:/jsonapi/entity_test/entity_test/' . $this->entity->uuid())->setAbsolute()->toString(TRUE)->getGeneratedUrl(); $author = User::load(0); - return [ + $normalization = [ 'jsonapi' => [ 'meta' => [ 'links' => [ @@ -139,6 +139,11 @@ class EntityTestTest extends ResourceTestBase { ], ], ]; + // @todo Remove this modification when JSON API requires Drupal 8.5 or newer, and do an early return above instead. + if (floatval(\Drupal::VERSION) < 8.5) { + unset($normalization['data']['attributes']['internal_string_field']); + } + return $normalization; } /** diff --git a/tests/src/Functional/NodeTest.php b/tests/src/Functional/NodeTest.php index c7ebca3..4c34cb8 100644 --- a/tests/src/Functional/NodeTest.php +++ b/tests/src/Functional/NodeTest.php @@ -115,7 +115,7 @@ class NodeTest extends ResourceTestBase { protected function getExpectedNormalizedEntity() { $author = User::load($this->entity->getOwnerId()); $self_url = Url::fromUri('base:/jsonapi/node/camelids/' . $this->entity->uuid())->setAbsolute()->toString(TRUE)->getGeneratedUrl(); - return [ + $normalization = [ 'jsonapi' => [ 'meta' => [ 'links' => [ @@ -196,6 +196,11 @@ class NodeTest extends ResourceTestBase { ], ], ]; + // @todo Remove this modification when JSON API requires Drupal 8.5 or newer, and do an early return above instead. + if (floatval(\Drupal::VERSION) < 8.5) { + unset($normalization['data']['attributes']['revision_default']); + } + return $normalization; } /** diff --git a/tests/src/Functional/TermTest.php b/tests/src/Functional/TermTest.php index 2e0034a..067e140 100644 --- a/tests/src/Functional/TermTest.php +++ b/tests/src/Functional/TermTest.php @@ -175,6 +175,14 @@ class TermTest extends ResourceTestBase { ]; break; } + + // @todo Remove thi when JSON API requires Drupal 8.5 or newer. + if (floatval(\Drupal::VERSION) < 8.5) { + $expected_parent_normalization = [ + 'data' => [], + ]; + } + return [ 'jsonapi' => [ 'meta' => [ @@ -230,6 +238,11 @@ class TermTest extends ResourceTestBase { ], ], ]; + // @todo Remove this modification when JSON API requires Drupal 8.5 or newer, and do an early return above instead. + if (floatval(\Drupal::VERSION) < 8.5) { + $normalization['data']['relationships']['parent'] = ['data' => []]; + } + return $normalization; } /**