You are here

public function BambooTwigI18nTest::testGetTranslation in Bamboo Twig 8.4

Same name and namespace in other branches
  1. 8.5 tests/src/Functional/BambooTwigI18nTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigI18nTest::testGetTranslation()
  2. 8.3 tests/src/Functional/BambooTwigI18nTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigI18nTest::testGetTranslation()

@covers Drupal\bamboo_twig_i18n\TwigExtension\I18n::getTranslation

File

tests/src/Functional/BambooTwigI18nTest.php, line 126

Class

BambooTwigI18nTest
Tests I18n twig filters and functions.

Namespace

Drupal\Tests\bamboo_twig\Functional

Code

public function testGetTranslation() {
  $this
    ->drupalGet('/bamboo-twig-i18n');
  $this
    ->assertElementContains('.test-i18n div.i18n-get-translation-node-1-ru', 'News N°1');
  $this
    ->assertElementContains('.test-i18n div.i18n-get-translation-node-1-en', 'News N°1');
  $this
    ->assertElementContains('.test-i18n div.i18n-get-translation-node-1-de', 'News N°1');
  $this
    ->assertElementContains('.test-i18n div.i18n-get-translation-node-1-fr', 'News N°1');
  $this
    ->assertElementContains('.test-i18n div.i18n-get-translation-node-2-en', 'News N°2');
  $this
    ->assertElementContains('.test-i18n div.i18n-get-translation-node-1-de', 'News N°1');
  $this
    ->assertElementContains('.test-i18n div.i18n-get-translation-node-2-fr', 'Article N°2');
  $this
    ->assertElementContains('.test-i18n div.i18n-get-translation-node-3-en', 'News N°3');
  $this
    ->assertElementContains('.test-i18n div.i18n-get-translation-node-3-de', 'Artikel N°3');
  $this
    ->assertElementContains('.test-i18n div.i18n-get-translation-node-3-fr', 'Article N°3');
  $this
    ->drupalGet('/bamboo-twig-i18n');
  $this
    ->assertElementContains('.test-i18n div.i18n-get-translation-node-1', 'News N°1');
  $this
    ->assertElementContains('.test-i18n div.i18n-get-translation-node-2', 'News N°2');
  $this
    ->assertElementContains('.test-i18n div.i18n-get-translation-node-3', 'News N°3');
  $this
    ->drupalGet('/fr/bamboo-twig-i18n');
  $this
    ->assertElementContains('.test-i18n div.i18n-get-translation-node-1', 'News N°1');
  $this
    ->assertElementContains('.test-i18n div.i18n-get-translation-node-2', 'Article N°2');
  $this
    ->assertElementContains('.test-i18n div.i18n-get-translation-node-3', 'Article N°3');
  $this
    ->drupalGet('/de/bamboo-twig-i18n');
  $this
    ->assertElementContains('.test-i18n div.i18n-get-translation-node-1', 'News N°1');
  $this
    ->assertElementContains('.test-i18n div.i18n-get-translation-node-2', 'News N°2');
  $this
    ->assertElementContains('.test-i18n div.i18n-get-translation-node-3', 'Artikel N°3');
}