function TwigSettingsTest::testTwigAutoReloadOverride in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/Theme/TwigSettingsTest.php \Drupal\system\Tests\Theme\TwigSettingsTest::testTwigAutoReloadOverride()
Ensures Twig template auto reload setting can be overridden.
File
- core/
modules/ system/ src/ Tests/ Theme/ TwigSettingsTest.php, line 30 - Contains \Drupal\system\Tests\Theme\TwigSettingsTest.
Class
- TwigSettingsTest
- Tests overriding Twig engine settings via settings.php.
Namespace
Drupal\system\Tests\ThemeCode
function testTwigAutoReloadOverride() {
// Enable auto reload and rebuild the service container.
$parameters = $this->container
->getParameter('twig.config');
$parameters['auto_reload'] = TRUE;
$this
->setContainerParameter('twig.config', $parameters);
$this
->rebuildContainer();
// Check isAutoReload() via the Twig service container.
$this
->assertTrue($this->container
->get('twig')
->isAutoReload(), 'Automatic reloading of Twig templates enabled.');
// Disable auto reload and check the service container again.
$parameters = $this->container
->getParameter('twig.config');
$parameters['auto_reload'] = FALSE;
$this
->setContainerParameter('twig.config', $parameters);
$this
->rebuildContainer();
$this
->assertFalse($this->container
->get('twig')
->isAutoReload(), 'Automatic reloading of Twig templates disabled.');
}