function AttributeTest::testTwigAddRemoveClasses
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Template/AttributeTest.php \Drupal\Tests\Core\Template\AttributeTest::testTwigAddRemoveClasses()
- 8.9.x core/tests/Drupal/Tests/Core/Template/AttributeTest.php \Drupal\Tests\Core\Template\AttributeTest::testTwigAddRemoveClasses()
- 10 core/tests/Drupal/Tests/Core/Template/AttributeTest.php \Drupal\Tests\Core\Template\AttributeTest::testTwigAddRemoveClasses()
Tests the twig calls to the Attribute. @dataProvider providerTestAttributeClassHelpers
@covers ::removeClass @covers ::addClass
File
-
core/
tests/ Drupal/ Tests/ Core/ Template/ AttributeTest.php, line 273
Class
- AttributeTest
- @coversDefaultClass \Drupal\Core\Template\Attribute @group Template
Namespace
Drupal\Tests\Core\TemplateCode
public function testTwigAddRemoveClasses($template, $expected, $seed_attributes = []) : void {
$loader = new StringLoader();
$twig = new Environment($loader);
$data = [
'attributes' => new Attribute($seed_attributes),
];
$result = $twig->createTemplate($template)
->render($data);
$this->assertEquals($expected, $result);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.