You are here

protected function MenuLinkContentResourceTestBase::getExpectedNormalizedEntity in Drupal 9

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

Returns the expected normalization of the entity.

Return value

array

Overrides EntityResourceTestBase::getExpectedNormalizedEntity

See also

::createEntity()

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

File

core/modules/menu_link_content/tests/src/Functional/Rest/MenuLinkContentResourceTestBase.php, line 108

Class

MenuLinkContentResourceTestBase
ResourceTestBase for MenuLinkContent entity.

Namespace

Drupal\Tests\menu_link_content\Functional\Rest

Code

protected function getExpectedNormalizedEntity() {
  return [
    'uuid' => [
      [
        'value' => $this->entity
          ->uuid(),
      ],
    ],
    'id' => [
      [
        'value' => 1,
      ],
    ],
    'revision_id' => [
      [
        'value' => 1,
      ],
    ],
    'title' => [
      [
        'value' => 'Llama Gabilondo',
      ],
    ],
    'link' => [
      [
        'uri' => 'https://nl.wikipedia.org/wiki/Llama',
        'title' => NULL,
        'options' => [
          'fragment' => 'a-fragment',
          'attributes' => [
            'class' => [
              'example-class',
            ],
          ],
        ],
      ],
    ],
    'weight' => [
      [
        'value' => 0,
      ],
    ],
    'menu_name' => [
      [
        'value' => 'main',
      ],
    ],
    'langcode' => [
      [
        'value' => 'en',
      ],
    ],
    'bundle' => [
      [
        'value' => 'menu_link_content',
      ],
    ],
    'description' => [
      [
        'value' => 'Llama Gabilondo',
      ],
    ],
    'external' => [
      [
        'value' => FALSE,
      ],
    ],
    'rediscover' => [
      [
        'value' => FALSE,
      ],
    ],
    'expanded' => [
      [
        'value' => FALSE,
      ],
    ],
    'enabled' => [
      [
        'value' => TRUE,
      ],
    ],
    'changed' => [
      [
        'value' => (new \DateTime())
          ->setTimestamp($this->entity
          ->getChangedTime())
          ->setTimezone(new \DateTimeZone('UTC'))
          ->format(\DateTime::RFC3339),
        'format' => \DateTime::RFC3339,
      ],
    ],
    'default_langcode' => [
      [
        'value' => TRUE,
      ],
    ],
    'parent' => [],
    'revision_created' => [
      [
        'value' => (new \DateTime())
          ->setTimestamp((int) $this->entity
          ->getRevisionCreationTime())
          ->setTimezone(new \DateTimeZone('UTC'))
          ->format(\DateTime::RFC3339),
        'format' => \DateTime::RFC3339,
      ],
    ],
    'revision_user' => [],
    'revision_log_message' => [],
    'revision_translation_affected' => [
      [
        'value' => TRUE,
      ],
    ],
  ];
}