public function AttributesTest::testAttributeIteration in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Common/AttributesTest.php \Drupal\Tests\Core\Common\AttributesTest::testAttributeIteration()
- 9 core/tests/Drupal/Tests/Core/Common/AttributesTest.php \Drupal\Tests\Core\Common\AttributesTest::testAttributeIteration()
Tests attribute iteration.
File
- core/
tests/ Drupal/ Tests/ Core/ Common/ AttributesTest.php, line 62
Class
- AttributesTest
- Tests the Drupal\Core\Template\Attribute functionality.
Namespace
Drupal\Tests\Core\CommonCode
public function testAttributeIteration() {
$attribute = new Attribute([
'key1' => 'value1',
]);
foreach ($attribute as $value) {
$this
->assertSame((string) $value, 'value1', 'Iterate over attribute.');
}
}