You are here

public function ConfigEntityAdapterTest::testGetProperties in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityAdapterTest.php \Drupal\KernelTests\Core\Entity\ConfigEntityAdapterTest::testGetProperties()

@covers ::getProperties

File

core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityAdapterTest.php, line 83

Class

ConfigEntityAdapterTest
Tests entity adapter for configuration entities.

Namespace

Drupal\KernelTests\Core\Entity

Code

public function testGetProperties() {
  $expected_properties = [
    'uuid' => StringData::class,
    'langcode' => StringData::class,
    'status' => BooleanData::class,
    'dependencies' => Mapping::class,
    'id' => StringData::class,
    'label' => StringData::class,
    'weight' => IntegerData::class,
    'style' => StringData::class,
    'size' => StringData::class,
    'size_value' => StringData::class,
    'protected_property' => StringData::class,
  ];
  $properties = ConfigEntityAdapter::createFromEntity($this->entity)
    ->getProperties();
  $keys = [];
  foreach ($properties as $key => $property) {
    $keys[] = $key;
    $this
      ->assertInstanceOf($expected_properties[$key], $property);
  }
  $this
    ->assertSame(array_keys($expected_properties), $keys);
}