public function AttributesTest::testAttributeValueBaseCopy in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Common/AttributesTest.php \Drupal\Tests\Core\Common\AttributesTest::testAttributeValueBaseCopy()
- 9 core/tests/Drupal/Tests/Core/Common/AttributesTest.php \Drupal\Tests\Core\Common\AttributesTest::testAttributeValueBaseCopy()
Tests AttributeValueBase copy.
File
- core/
tests/ Drupal/ Tests/ Core/ Common/ AttributesTest.php, line 72
Class
- AttributesTest
- Tests the Drupal\Core\Template\Attribute functionality.
Namespace
Drupal\Tests\Core\CommonCode
public function testAttributeValueBaseCopy() {
$original_attributes = new Attribute([
'checked' => TRUE,
'class' => [
'who',
'is',
'on',
],
'id' => 'first',
]);
$attributes['selected'] = $original_attributes['checked'];
$attributes['id'] = $original_attributes['id'];
$attributes = new Attribute($attributes);
$this
->assertSame(' checked class="who is on" id="first"', (string) $original_attributes, 'Original boolean value used with original name.');
$this
->assertSame(' selected id="first"', (string) $attributes, 'Original boolean value used with new name.');
}