function TwigSandboxTest::testExtendedClass

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Template/TwigSandboxTest.php \Drupal\Tests\Core\Template\TwigSandboxTest::testExtendedClass()
  2. 10 core/tests/Drupal/Tests/Core/Template/TwigSandboxTest.php \Drupal\Tests\Core\Template\TwigSandboxTest::testExtendedClass()
  3. 11.x 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 71

Class

TwigSandboxTest
Tests the twig sandbox policy.

Namespace

Drupal\Tests\Core\Template

Code

public function testExtendedClass() {
    $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.