function TwigTransTest::testTwigTransTags

Same name in other branches
  1. 8.9.x core/modules/system/tests/src/Functional/Theme/TwigTransTest.php \Drupal\Tests\system\Functional\Theme\TwigTransTest::testTwigTransTags()
  2. 10 core/modules/system/tests/src/Functional/Theme/TwigTransTest.php \Drupal\Tests\system\Functional\Theme\TwigTransTest::testTwigTransTags()
  3. 11.x core/modules/system/tests/src/Functional/Theme/TwigTransTest.php \Drupal\Tests\system\Functional\Theme\TwigTransTest::testTwigTransTags()

Tests Twig "trans" tags.

File

core/modules/system/tests/src/Functional/Theme/TwigTransTest.php, line 83

Class

TwigTransTest
Tests Twig "trans" tags.

Namespace

Drupal\Tests\system\Functional\Theme

Code

public function testTwigTransTags() {
    // Run this once without and once with Twig debug because trans can work
    // differently depending on that setting.
    $this->drupalGet('twig-theme-test/trans', [
        'language' => \Drupal::languageManager()->getLanguage('xx'),
    ]);
    $this->assertTwigTransTags();
    // Enable debug, rebuild the service container, and clear all caches.
    $parameters = $this->container
        ->getParameter('twig.config');
    $parameters['debug'] = TRUE;
    $this->setContainerParameter('twig.config', $parameters);
    $this->rebuildContainer();
    $this->resetAll();
    $this->drupalGet('twig-theme-test/trans', [
        'language' => \Drupal::languageManager()->getLanguage('xx'),
    ]);
    $this->assertTwigTransTags();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.