function TwigExtensionTest::testTwigExtensionLoaded

Tests that the provided Twig extension loads the service appropriately.

File

core/modules/system/tests/src/Functional/Theme/TwigExtensionTest.php, line 38

Class

TwigExtensionTest
Tests Twig extensions.

Namespace

Drupal\Tests\system\Functional\Theme

Code

public function testTwigExtensionLoaded() {
  $twigService = \Drupal::service('twig');
  $ext = $twigService->getExtension(TestExtension::class);
  $this->assertInstanceOf(TestExtension::class, $ext);
}

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