You are here

protected function NodeResourceTestBase::getExpectedNormalizedEntity in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/node/tests/src/Functional/Rest/NodeResourceTestBase.php \Drupal\Tests\node\Functional\Rest\NodeResourceTestBase::getExpectedNormalizedEntity()

Returns the expected normalization of the entity.

Return value

array

Overrides EntityResourceTestBase::getExpectedNormalizedEntity

See also

::createEntity()

2 calls to NodeResourceTestBase::getExpectedNormalizedEntity()
ModeratedNodeResourceTestBase::getExpectedNormalizedEntity in core/modules/rest/tests/src/Functional/EntityResource/ModeratedNode/ModeratedNodeResourceTestBase.php
Returns the expected normalization of the entity.
NodeHalJsonAnonTest::getExpectedNormalizedEntity in core/modules/node/tests/src/Functional/Hal/NodeHalJsonAnonTest.php
Returns the expected normalization of the entity.
2 methods override NodeResourceTestBase::getExpectedNormalizedEntity()
ModeratedNodeResourceTestBase::getExpectedNormalizedEntity in core/modules/rest/tests/src/Functional/EntityResource/ModeratedNode/ModeratedNodeResourceTestBase.php
Returns the expected normalization of the entity.
NodeHalJsonAnonTest::getExpectedNormalizedEntity in core/modules/node/tests/src/Functional/Hal/NodeHalJsonAnonTest.php
Returns the expected normalization of the entity.

File

core/modules/node/tests/src/Functional/Rest/NodeResourceTestBase.php, line 100

Class

NodeResourceTestBase

Namespace

Drupal\Tests\node\Functional\Rest

Code

protected function getExpectedNormalizedEntity() {
  $author = User::load($this->entity
    ->getOwnerId());
  return [
    'nid' => [
      [
        'value' => 1,
      ],
    ],
    'uuid' => [
      [
        'value' => $this->entity
          ->uuid(),
      ],
    ],
    'vid' => [
      [
        'value' => 1,
      ],
    ],
    'langcode' => [
      [
        'value' => 'en',
      ],
    ],
    'type' => [
      [
        'target_id' => 'camelids',
        'target_type' => 'node_type',
        'target_uuid' => NodeType::load('camelids')
          ->uuid(),
      ],
    ],
    'title' => [
      [
        'value' => 'Llama',
      ],
    ],
    'status' => [
      [
        'value' => TRUE,
      ],
    ],
    'created' => [
      $this
        ->formatExpectedTimestampItemValues(123456789),
    ],
    'changed' => [
      $this
        ->formatExpectedTimestampItemValues($this->entity
        ->getChangedTime()),
    ],
    'promote' => [
      [
        'value' => TRUE,
      ],
    ],
    'sticky' => [
      [
        'value' => FALSE,
      ],
    ],
    'revision_timestamp' => [
      $this
        ->formatExpectedTimestampItemValues(123456789),
    ],
    'revision_translation_affected' => [
      [
        'value' => TRUE,
      ],
    ],
    'default_langcode' => [
      [
        'value' => TRUE,
      ],
    ],
    'uid' => [
      [
        'target_id' => (int) $author
          ->id(),
        'target_type' => 'user',
        'target_uuid' => $author
          ->uuid(),
        'url' => base_path() . 'user/' . $author
          ->id(),
      ],
    ],
    'revision_uid' => [
      [
        'target_id' => (int) $author
          ->id(),
        'target_type' => 'user',
        'target_uuid' => $author
          ->uuid(),
        'url' => base_path() . 'user/' . $author
          ->id(),
      ],
    ],
    'revision_log' => [],
    'path' => [
      [
        'alias' => '/llama',
        'pid' => 1,
        'langcode' => 'en',
      ],
    ],
  ];
}