protected function LanguageUILanguageNegotiationTest::runTest

1 call to LanguageUILanguageNegotiationTest::runTest()
LanguageUILanguageNegotiationTest::testUILanguageNegotiation in drupal/core/modules/language/lib/Drupal/language/Tests/LanguageUILanguageNegotiationTest.php
Tests for language switching by URL path.

File

drupal/core/modules/language/lib/Drupal/language/Tests/LanguageUILanguageNegotiationTest.php, line 359
Definition of Drupal\language\Tests\LanguageUILanguageNegotiationTest.

Class

LanguageUILanguageNegotiationTest
Test UI language negotiation

Namespace

Drupal\language\Tests

Code

protected function runTest($test) {
  if (!empty($test['language_negotiation'])) {
    $method_weights = array_flip($test['language_negotiation']);
    language_negotiation_set(LANGUAGE_TYPE_INTERFACE, $method_weights);
  }
  if (!empty($test['language_negotiation_url_part'])) {
    config('language.negotiation')
      ->set('url.source', $test['language_negotiation_url_part'])
      ->save();
  }
  if (!empty($test['language_test_domain'])) {
    state()
      ->set('language_test.domain', $test['language_test_domain']);
  }
  $this
    ->drupalGet($test['path'], array(), $test['http_header']);
  $this
    ->assertText($test['expect'], $test['message']);
  $this
    ->assertText(t('Language negotiation method: @name', array(
    '@name' => $test['expected_method_id'],
  )));
}