public function LanguageSelectionPageConditionTest::testEnabledLanguages in Language Selection Page 8.2
Test the "language prefixes" condition.
File
- tests/
src/ Functional/ LanguageSelectionPageConditionTest.php, line 160
Class
- LanguageSelectionPageConditionTest
- Tests that the condition plugins work.
Namespace
Drupal\Tests\language_selection_page\FunctionalCode
public function testEnabledLanguages() {
$node = $this
->drupalCreateNode();
$this
->drupalGet('node/' . $node
->id());
$this
->assertLanguageSelectionPageLoaded();
// Set prefixes to fr only.
$this
->drupalPostForm('admin/config/regional/language/detection/url', [
'prefix[en]' => '',
'prefix[fr]' => 'fr',
], 'Save configuration');
$this
->drupalGet('node/' . $node
->id());
$this
->assertLanguageSelectionPageNotLoaded();
$this
->drupalGet('admin/reports/status');
// Look for "You should add a path prefix to English language if you want
// to have it enabled in the Language Selection Page.".
$this
->assertSession()
->pageTextContains('language if you want to have it enabled in the Language Selection Page');
$this
->drupalPostForm('admin/config/regional/language/detection/url', [
'prefix[en]' => 'en',
'prefix[fr]' => 'fr',
], 'Save configuration');
$this
->drupalGet('admin/reports/status');
$this
->assertSession()
->pageTextNotContains('language if you want to have it enabled in the Language Selection Page');
$this
->resetConfiguration();
}