function ConfigEntityAdapterTest::testGetProperties

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityAdapterTest.php \Drupal\KernelTests\Core\Entity\ConfigEntityAdapterTest::testGetProperties()
  2. 10 core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityAdapterTest.php \Drupal\KernelTests\Core\Entity\ConfigEntityAdapterTest::testGetProperties()
  3. 11.x 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);
}

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