function TwigExtensionTest::testTwigSetAttribute

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

Tests Twig 'set_attribute' filter.

@covers ::setAttribute @dataProvider providerTestTwigSetAttribute

File

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

Class

TwigExtensionTest
Tests the twig extension.

Namespace

Drupal\Tests\Core\Template

Code

public function testTwigSetAttribute($element, $key, $value, $expected_result) : void {
    $processed = $this->systemUnderTest
        ->setAttribute($element, $key, $value);
    $this->assertEquals($expected_result, $processed);
}

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