public function ConfigEntityAdapterTest::testGetIterator in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityAdapterTest.php \Drupal\KernelTests\Core\Entity\ConfigEntityAdapterTest::testGetIterator()
- 9 core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityAdapterTest.php \Drupal\KernelTests\Core\Entity\ConfigEntityAdapterTest::testGetIterator()
@covers ::getIterator
File
- core/
tests/ Drupal/ KernelTests/ Core/ Entity/ ConfigEntityAdapterTest.php, line 153
Class
- ConfigEntityAdapterTest
- Tests entity adapter for configuration entities.
Namespace
Drupal\KernelTests\Core\EntityCode
public function testGetIterator() {
$adapter = ConfigEntityAdapter::createFromEntity($this->entity);
$iterator = $adapter
->getIterator();
$fields = iterator_to_array($iterator);
$expected_fields = [
'uuid',
'langcode',
'status',
'dependencies',
'id',
'label',
'weight',
'style',
'size',
'size_value',
'protected_property',
];
$this
->assertEquals($expected_fields, array_keys($fields));
$this
->assertEquals($this->entity
->id(), $fields['id']
->getValue());
$adapter
->setValue(NULL);
$this
->assertEquals(new \ArrayIterator([]), $adapter
->getIterator());
}