function TwigExtensionTest::testTwigAddClass

Same name in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php \Drupal\Tests\Core\Template\TwigExtensionTest::testTwigAddClass()

Tests Twig 'add_class' filter.

@covers ::addClass @dataProvider providerTestTwigAddClass

File

core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php, line 558

Class

TwigExtensionTest
Tests the twig extension.

Namespace

Drupal\Tests\Core\Template

Code

public function testTwigAddClass($element, $classes, $expected_result) : void {
    $processed = $this->systemUnderTest
        ->addClass($element, $classes);
    $this->assertEquals($expected_result, $processed);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.