public function TwigEnvironmentTest::testCacheFilename in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/Theme/TwigEnvironmentTest.php \Drupal\system\Tests\Theme\TwigEnvironmentTest::testCacheFilename()
Ensures that cacheFilename() varies by extensions + deployment identifier.
File
- core/
modules/ system/ src/ Tests/ Theme/ TwigEnvironmentTest.php, line 118 - Contains \Drupal\system\Tests\Theme\TwigEnvironmentTest.
Class
- TwigEnvironmentTest
- Tests the twig environment.
Namespace
Drupal\system\Tests\ThemeCode
public function testCacheFilename() {
/** @var \Drupal\Core\Template\TwigEnvironment $environment */
// Note: Later we refetch the twig service in order to bypass its internal
// static cache.
$environment = \Drupal::service('twig');
$original_filename = $environment
->getCacheFilename('core/modules/system/templates/container.html.twig');
\Drupal::getContainer()
->set('twig', NULL);
\Drupal::service('module_installer')
->install([
'twig_extension_test',
]);
$environment = \Drupal::service('twig');
$new_extension_filename = $environment
->getCacheFilename('core/modules/system/templates/container.html.twig');
\Drupal::getContainer()
->set('twig', NULL);
$this
->assertNotEqual($new_extension_filename, $original_filename);
}