You are here

public function SearchByPageIntlTest::doLanguageTest in Search by Page 8

Tests that the right strings are present for the given language.

1 call to SearchByPageIntlTest::doLanguageTest()
SearchByPageIntlTest::testTranslations in tests/src/Functional/search_by_page.test
Tests that environment settings for main module and paths are translated.

File

tests/src/Functional/search_by_page.test, line 2798
Tests for the Search by Page module. By Jennifer Hodgdon of Poplar ProductivityWare, www.poplarware.com

Class

SearchByPageIntlTest
Environment internationalization test.

Namespace

Drupal\Tests\search_by_page\Functional

Code

public function doLanguageTest($lang) {

  // Figure out which strings we want to look for and verify are not there.
  $good = $this->envinfo1;
  $bad = $this->strings_to_test;
  if ($lang != 'en') {
    $bad = $this->envinfo1;
    $good = $this->strings_to_test;
  }

  // Verify that all the good strings are there and not the bad ones.
  foreach ($this->strings_to_test as $key => $ignore) {
    $this
      ->assertRaw($good[$key], "Text for {$key} in right language is present");
    $this
      ->assertNoRaw($bad[$key], "Text for {$key} in other language is not present");
  }
}