You are here

protected function BlockContentResourceTestBase::getExpectedNormalizedEntity in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/block_content/tests/src/Functional/Rest/BlockContentResourceTestBase.php \Drupal\Tests\block_content\Functional\Rest\BlockContentResourceTestBase::getExpectedNormalizedEntity()
  2. 10 core/modules/block_content/tests/src/Functional/Rest/BlockContentResourceTestBase.php \Drupal\Tests\block_content\Functional\Rest\BlockContentResourceTestBase::getExpectedNormalizedEntity()

Returns the expected normalization of the entity.

Return value

array

Overrides EntityResourceTestBase::getExpectedNormalizedEntity

See also

::createEntity()

1 call to BlockContentResourceTestBase::getExpectedNormalizedEntity()
BlockContentHalJsonAnonTest::getExpectedNormalizedEntity in core/modules/block_content/tests/src/Functional/Hal/BlockContentHalJsonAnonTest.php
Returns the expected normalization of the entity.
1 method overrides BlockContentResourceTestBase::getExpectedNormalizedEntity()
BlockContentHalJsonAnonTest::getExpectedNormalizedEntity in core/modules/block_content/tests/src/Functional/Hal/BlockContentHalJsonAnonTest.php
Returns the expected normalization of the entity.

File

core/modules/block_content/tests/src/Functional/Rest/BlockContentResourceTestBase.php, line 75

Class

BlockContentResourceTestBase
ResourceTestBase for BlockContent entity.

Namespace

Drupal\Tests\block_content\Functional\Rest

Code

protected function getExpectedNormalizedEntity() {
  return [
    'id' => [
      [
        'value' => 1,
      ],
    ],
    'uuid' => [
      [
        'value' => $this->entity
          ->uuid(),
      ],
    ],
    'langcode' => [
      [
        'value' => 'en',
      ],
    ],
    'reusable' => [
      [
        'value' => TRUE,
      ],
    ],
    'type' => [
      [
        'target_id' => 'basic',
        'target_type' => 'block_content_type',
        'target_uuid' => BlockContentType::load('basic')
          ->uuid(),
      ],
    ],
    'info' => [
      [
        'value' => 'Llama',
      ],
    ],
    'revision_log' => [],
    'changed' => [
      [
        'value' => (new \DateTime())
          ->setTimestamp((int) $this->entity
          ->getChangedTime())
          ->setTimezone(new \DateTimeZone('UTC'))
          ->format(\DateTime::RFC3339),
        'format' => \DateTime::RFC3339,
      ],
    ],
    'revision_id' => [
      [
        'value' => 1,
      ],
    ],
    'revision_created' => [
      [
        'value' => (new \DateTime())
          ->setTimestamp((int) $this->entity
          ->getRevisionCreationTime())
          ->setTimezone(new \DateTimeZone('UTC'))
          ->format(\DateTime::RFC3339),
        'format' => \DateTime::RFC3339,
      ],
    ],
    'revision_user' => [],
    'revision_translation_affected' => [
      [
        'value' => TRUE,
      ],
    ],
    'default_langcode' => [
      [
        'value' => TRUE,
      ],
    ],
    'body' => [
      [
        'value' => 'The name "llama" was adopted by European settlers from native Peruvians.',
        'format' => 'plain_text',
        'summary' => NULL,
        'processed' => "<p>The name &quot;llama&quot; was adopted by European settlers from native Peruvians.</p>\n",
      ],
    ],
    'status' => [
      [
        'value' => FALSE,
      ],
    ],
  ];
}