You are here

public function TwigExtensionTest::testTwigExtensionLoaded in Drupal 9

Same name and namespace in other branches
  1. 8 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);
}