protected function LanguageUILanguageNegotiationTest::runTest in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/language/src/Tests/LanguageUILanguageNegotiationTest.php \Drupal\language\Tests\LanguageUILanguageNegotiationTest::runTest()
1 call to LanguageUILanguageNegotiationTest::runTest()
- LanguageUILanguageNegotiationTest::testUILanguageNegotiation in core/
modules/ language/ src/ Tests/ LanguageUILanguageNegotiationTest.php - Tests for language switching by URL path.
File
- core/
modules/ language/ src/ Tests/ LanguageUILanguageNegotiationTest.php, line 349 - Contains \Drupal\language\Tests\LanguageUILanguageNegotiationTest.
Class
- LanguageUILanguageNegotiationTest
- Tests the language UI for language switching.
Namespace
Drupal\language\TestsCode
protected function runTest($test) {
$test += array(
'path_options' => [],
);
if (!empty($test['language_negotiation'])) {
$method_weights = array_flip($test['language_negotiation']);
$this->container
->get('language_negotiator')
->saveConfiguration(LanguageInterface::TYPE_INTERFACE, $method_weights);
}
if (!empty($test['language_negotiation_url_part'])) {
$this
->config('language.negotiation')
->set('url.source', $test['language_negotiation_url_part'])
->save();
}
if (!empty($test['language_test_domain'])) {
\Drupal::state()
->set('language_test.domain', $test['language_test_domain']);
}
$this->container
->get('language_manager')
->reset();
$this
->drupalGet($test['path'], $test['path_options'], $test['http_header']);
$this
->assertText($test['expect'], $test['message']);
$this
->assertText(t('Language negotiation method: @name', array(
'@name' => $test['expected_method_id'],
)));
}