public function MenuMultilingualTest::testViewsMenuItemTranslated in Menu Multilingual 8
Test for View translated Menu Items.
File
- tests/
src/ Functional/ MenuMultilingualTest.php, line 468
Class
- MenuMultilingualTest
- Class MenuMultilingualTest.
Namespace
Drupal\Tests\menu_multilingual\FunctionalCode
public function testViewsMenuItemTranslated() {
// Create 4 translated custom menu links in the main menu.
$this
->createViewsMenuItemTranslated();
$session = $this
->assertSession();
// Test defaults without any configurations.
$this
->drupalGet('node');
$session
->pageTextContains('Views English menu item');
$this
->drupalGet('fr/node');
$session
->pageTextContains('Views French menu item');
// Test 'Hide menu items without translated label'.
$edit = [
'settings[only_translated_labels]' => 1,
'settings[only_translated_content]' => 0,
];
$this
->drupalGet($this->menuBlockConfigPath);
$this
->submitForm($edit, 'Save block');
$this
->drupalGet('node');
$session
->pageTextContains('Views English menu item');
$this
->drupalGet('fr/node');
$session
->pageTextContains('Views French menu item');
// Test 'Hide menu items without translated label' and
// 'Hide menu items without translated content'.
$edit = [
'settings[only_translated_labels]' => 1,
'settings[only_translated_content]' => 1,
];
$this
->drupalGet($this->menuBlockConfigPath);
$this
->submitForm($edit, 'Save block');
$this
->drupalGet('node');
$session
->pageTextContains('Views English menu item');
$this
->drupalGet('fr/node');
$session
->pageTextContains('Views French menu item');
// Test 'Hide menu items without translated content'.
$edit = [
'settings[only_translated_labels]' => 0,
'settings[only_translated_content]' => 1,
];
$this
->drupalGet($this->menuBlockConfigPath);
$this
->submitForm($edit, 'Save block');
$this
->drupalGet('node');
$session
->pageTextContains('Views English menu item');
$this
->drupalGet('fr/node');
$session
->pageTextContains('Views French menu item');
}