You are here

public function AttributeTest::testTwigAddRemoveClasses in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 270
Contains \Drupal\Tests\Core\Template\AttributeTest.

Class

AttributeTest
@coversDefaultClass \Drupal\Core\Template\Attribute @group Template

Namespace

Drupal\Tests\Core\Template

Code

public function testTwigAddRemoveClasses($template, $expected, $seed_attributes = array()) {
  $loader = new \Twig_Loader_String();
  $twig = new \Twig_Environment($loader);
  $data = array(
    'attributes' => new Attribute($seed_attributes),
  );
  $result = $twig
    ->render($template, $data);
  $this
    ->assertEquals($expected, $result);
}