You are here

public function SearchByPageIntlTest::setUp in Search by Page 8

Overrides SearchByPageTesterTest::setUp

File

tests/src/Functional/search_by_page.test, line 2643
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 setUp() {
  parent::setUp('locale', 'translation', 'search', 'search_by_page', 'variable', 'i18n', 'i18n_string', 'search_by_page_paths', 'search_by_page_test', 'block');
  $this
    ->setUpEnvironments();
  $this->superuser = $this
    ->drupalCreateUser(array(
    'administer blocks',
    'access administration pages',
    'administer search',
    'administer search by page',
    'search content',
    'access content',
    $this
      ->searchPerm($this->envinfo1),
    'administer site configuration',
    'administer permissions',
    'administer languages',
    'translate interface',
    'translate user-defined strings',
    'translate admin strings',
  ));
  $this
    ->drupalLogin($this->superuser);

  // Set up the languages, environments, path, and block. Run cron.
  $this
    ->setUpLanguages();
  $this
    ->setUpPath();
  $this
    ->drupalPostForm('admin/structure/block', array(
    'blocks[search_by_page_' . $this->envid1 . '][region]' => 'content',
  ), 'Save blocks');
  \Drupal::service('cache.bootstrap')
    ->invalidateAll();
  variable_initialize();
  drupal_static_reset();

  // Visit the foreign-language search page to trigger the page title getting
  // added to the translation interface.
  $languageManager = new \Drupal\Core\Language\LanguageManager();
  $langs = $languageManager
    ->getLanguages();
  $lang = $langs[$this->lang_to_use];
  $this
    ->drupalGet($this->envinfo1['page_path'], array(
    'language' => $lang,
  ));

  // Run cron to index.
  $this
    ->doCronrun();
  $this
    ->drupalLogin($this->superuser);
}