public function AttributeTest::testChainAddRemoveClasses in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Core/Template/AttributeTest.php \Drupal\Tests\Core\Template\AttributeTest::testChainAddRemoveClasses()
Tests removing class attributes with the Attribute helper methods. @covers ::removeClass @covers ::addClass
File
- core/
tests/ Drupal/ Tests/ Core/ Template/ AttributeTest.php, line 250 - Contains \Drupal\Tests\Core\Template\AttributeTest.
Class
- AttributeTest
- @coversDefaultClass \Drupal\Core\Template\Attribute @group Template
Namespace
Drupal\Tests\Core\TemplateCode
public function testChainAddRemoveClasses() {
$attribute = new Attribute(array(
'class' => array(
'example-class',
'red',
'green',
'blue',
),
));
$attribute
->removeClass(array(
'red',
'green',
'pink',
))
->addClass(array(
'apple',
'lime',
'grapefruit',
))
->addClass(array(
'banana',
));
$expected = array(
'example-class',
'blue',
'apple',
'lime',
'grapefruit',
'banana',
);
$this
->assertArrayEquals($expected, $attribute['class']
->value(), 'Attributes chained');
}