function TwigExtensionTest::testActiveThemePath
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php \Drupal\Tests\Core\Template\TwigExtensionTest::testActiveThemePath()
- 8.9.x core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php \Drupal\Tests\Core\Template\TwigExtensionTest::testActiveThemePath()
- 11.x core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php \Drupal\Tests\Core\Template\TwigExtensionTest::testActiveThemePath()
Tests the active_theme_path function.
File
-
core/
tests/ Drupal/ Tests/ Core/ Template/ TwigExtensionTest.php, line 206
Class
- TwigExtensionTest
- Tests the twig extension.
Namespace
Drupal\Tests\Core\TemplateCode
public function testActiveThemePath() : void {
$active_theme = $this->getMockBuilder('\\Drupal\\Core\\Theme\\ActiveTheme')
->disableOriginalConstructor()
->getMock();
$active_theme->expects($this->once())
->method('getPath')
->willReturn('foo/bar');
$this->themeManager
->expects($this->once())
->method('getActiveTheme')
->willReturn($active_theme);
$loader = new StringLoader();
$twig = new Environment($loader);
$twig->addExtension($this->systemUnderTest);
$result = $twig->render('{{ active_theme_path() }}');
$this->assertEquals('foo/bar', $result);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.