function MenuTranslationHierarchyWebTestCase::testMenuTranslateLocalize in Language Hierarchy 7
File
- modules/
i18n_menu_hierarchy/ tests/ i18n_menu_hierarchy.test, line 98 - Tests for Menu Translation Hierarchy module.
Class
- MenuTranslationHierarchyWebTestCase
- Functional tests for entity translation.
Code
function testMenuTranslateLocalize() {
// Test filtering for menu blocks.
$menu = $this
->createMenu(array(
'i18n_mode' => I18N_MODE_MULTIPLE,
));
$neutral_item = $this
->createMenuLink(array(
'menu_name' => $menu['menu_name'],
));
$en_item = $this
->createMenuLink(array(
'menu_name' => $menu['menu_name'],
'language' => 'en',
));
$pt_item = $this
->createMenuLink(array(
'menu_name' => $menu['menu_name'],
'language' => 'pt',
));
$pt_pt_item = $this
->createMenuLink(array(
'menu_name' => $menu['menu_name'],
'language' => 'pt-br',
));
$block['title'] = $menu['title'];
$block['module'] = 'menu';
$block['delta'] = $menu['menu_name'];
$this
->moveBlockToRegion($block, 'sidebar_first');
// Test if languages are filtered.
$this
->get('en', '<front>');
$this
->assertText($neutral_item['link_title'], 'Neutral menu item found on English language.');
$this
->assertText($en_item['link_title'], 'English menu item found on English language.');
$this
->assertNoText($pt_item['link_title'], 'No Portuguese, International menu item found on English language.');
$this
->assertNoText($pt_pt_item['link_title'], 'No Portuguese, Brazil menu item found on English language.');
// Test if links are displayed when translation exists.
$this
->get('pt-br', '<front>');
$this
->assertText($neutral_item['link_title'], 'Neutral menu item found on Portuguese, Brazil language.');
$this
->assertNoText($en_item['link_title'], 'No English menu item found on English language.');
$this
->assertNoText($pt_item['link_title'], 'No Portuguese, International menu item found on Portuguese, Brazil language.');
$this
->assertText($pt_pt_item['link_title'], 'Portuguese, Brazil menu item found on Portuguese, Brazil language.');
// Test if links will be inherited from parent language since there is no links
// for Portuguese, Portugal language but they exists for parent Portuguese, International.
$this
->get('pt-pt', '<front>');
$this
->assertText($neutral_item['link_title'], 'Neutral menu item found on Portuguese, Portugal language.');
$this
->assertNoText($en_item['link_title'], 'No English menu item found on Portuguese, Portugal language.');
$this
->assertText($pt_item['link_title'], 'Portuguese, International menu item found on Portuguese, Portugal language.');
$this
->assertNoText($pt_pt_item['link_title'], 'No Portuguese, Brazil menu item found on Portuguese, Portugal language.');
}