function TwigSandboxTest::testExtendedClass

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Template/TwigSandboxTest.php \Drupal\Tests\Core\Template\TwigSandboxTest::testExtendedClass()
  2. 8.9.x core/tests/Drupal/Tests/Core/Template/TwigSandboxTest.php \Drupal\Tests\Core\Template\TwigSandboxTest::testExtendedClass()
  3. 10 core/tests/Drupal/Tests/Core/Template/TwigSandboxTest.php \Drupal\Tests\Core\Template\TwigSandboxTest::testExtendedClass()

Tests that white listed classes can be extended.

File

core/tests/Drupal/Tests/Core/Template/TwigSandboxTest.php, line 72

Class

TwigSandboxTest
Tests the twig sandbox policy.

Namespace

Drupal\Tests\Core\Template

Code

public function testExtendedClass() : void {
    $this->assertEquals(' class="kitten"', $this->twig
        ->render('{{ attribute.addClass("kitten") }}', [
        'attribute' => new TestAttribute(),
    ]));
}

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