You are here

public function TwigExtensionTest::testTwigExtensionLoaded in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/system/tests/src/Functional/Theme/TwigExtensionTest.php \Drupal\Tests\system\Functional\Theme\TwigExtensionTest::testTwigExtensionLoaded()
  2. 10 core/modules/system/tests/src/Functional/Theme/TwigExtensionTest.php \Drupal\Tests\system\Functional\Theme\TwigExtensionTest::testTwigExtensionLoaded()

Tests that the provided Twig extension loads the service appropriately.

File

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

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);
}