function NodeResourceTestBase::getExpectedNormalizedEntity

Same name in other branches
  1. 9 core/modules/node/tests/src/Functional/Rest/NodeResourceTestBase.php \Drupal\Tests\node\Functional\Rest\NodeResourceTestBase::getExpectedNormalizedEntity()
  2. 10 core/modules/node/tests/src/Functional/Rest/NodeResourceTestBase.php \Drupal\Tests\node\Functional\Rest\NodeResourceTestBase::getExpectedNormalizedEntity()
  3. 11.x core/modules/node/tests/src/Functional/Rest/NodeResourceTestBase.php \Drupal\Tests\node\Functional\Rest\NodeResourceTestBase::getExpectedNormalizedEntity()

Overrides EntityResourceTestBase::getExpectedNormalizedEntity

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',
            ],
        ],
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.