You are here

protected function BlockContentResourceTestBase::getExpectedNormalizedEntity in Drupal 10

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. 9 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()

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