function TwigExtensionTest::testTwigExtensionLoaded
Same name in other branches
- 8.9.x core/modules/system/tests/src/Functional/Theme/TwigExtensionTest.php \Drupal\Tests\system\Functional\Theme\TwigExtensionTest::testTwigExtensionLoaded()
- 10 core/modules/system/tests/src/Functional/Theme/TwigExtensionTest.php \Drupal\Tests\system\Functional\Theme\TwigExtensionTest::testTwigExtensionLoaded()
- 11.x 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 38
Class
- TwigExtensionTest
- Tests Twig extensions.
Namespace
Drupal\Tests\system\Functional\ThemeCode
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.