function ModeratedNodeResourceTestBase::getExpectedNormalizedEntity

Same name in other branches
  1. 9 core/modules/rest/tests/src/Functional/EntityResource/ModeratedNode/ModeratedNodeResourceTestBase.php \Drupal\Tests\rest\Functional\EntityResource\ModeratedNode\ModeratedNodeResourceTestBase::getExpectedNormalizedEntity()
  2. 8.9.x core/modules/rest/tests/src/Functional/EntityResource/ModeratedNode/ModeratedNodeResourceTestBase.php \Drupal\Tests\rest\Functional\EntityResource\ModeratedNode\ModeratedNodeResourceTestBase::getExpectedNormalizedEntity()
  3. 10 core/modules/rest/tests/src/Functional/EntityResource/ModeratedNode/ModeratedNodeResourceTestBase.php \Drupal\Tests\rest\Functional\EntityResource\ModeratedNode\ModeratedNodeResourceTestBase::getExpectedNormalizedEntity()

Overrides NodeResourceTestBase::getExpectedNormalizedEntity

File

core/modules/rest/tests/src/Functional/EntityResource/ModeratedNode/ModeratedNodeResourceTestBase.php, line 62

Class

ModeratedNodeResourceTestBase
Extend the Node resource test base and apply moderation to the entity.

Namespace

Drupal\Tests\rest\Functional\EntityResource\ModeratedNode

Code

protected function getExpectedNormalizedEntity() {
    return array_merge(parent::getExpectedNormalizedEntity(), [
        'moderation_state' => [
            [
                'value' => 'published',
            ],
        ],
        'vid' => [
            [
                'value' => (int) $this->entity
                    ->getRevisionId(),
            ],
        ],
    ]);
}

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