public function LanguageSwitcherExtendedTest::testLinkUntranslatedEntityLanguageToFront in Language Switcher Extended 8
Tests, to link language switcher item for an untranslated entity to front.
File
- tests/
src/ Functional/ LanguageSwitcherExtendedTest.php, line 112
Class
- LanguageSwitcherExtendedTest
- Functional tests for the language_switcher_extended feature.
Namespace
Drupal\Tests\language_switcher_extended\FunctionalCode
public function testLinkUntranslatedEntityLanguageToFront() {
// Open the module's configuration page.
$this
->drupalGet('admin/config/regional/language/language-switcher-extended');
// Configure to link untranslated translations to the front.
$edit = [
'mode' => 'process_untranslated',
'untranslated_handler' => 'link_to_front',
];
$this
->submitForm($edit, 'Save configuration');
// Open the node without a translation.
$this
->drupalGet('node/1');
// Verify, that the untranslated language switcher links lead to the
// frontpage.
$this
->assertSession()
->elementAttributeContains('css', '#block-test-language-block li[hreflang="en"] a', 'data-drupal-link-system-path', 'node/1');
$this
->assertSession()
->elementAttributeContains('css', '#block-test-language-block li[hreflang="de"] a', 'data-drupal-link-system-path', '<front>');
}