1 menu_language.test | public MenuLanguageTestCase::setUp() |
Set up test environment.
Overrides BackdropWebTestCase::setUp
File
- core/
modules/ menu/ tests/ menu_language.test, line 80 - Tests for menu.module.
Class
- MenuLanguageTestCase
- Functional tests for multilingual menu items.
Code
public function setUp() {
parent::setUp('menu', 'language', 'locale');
// Add languages.
$this->langcodes = array('es');
foreach ($this->langcodes as $langcode) {
$new_lang = (object) array(
'langcode' => $langcode,
);
language_save($new_lang);
}
$this->langcodes[] = 'en';
$this->langcodes[] = LANGUAGE_NONE;
// First remove all existing menu links.
db_truncate('menu_links')->execute();
// Add some (unnested) items to main menu.
foreach ($this->langcodes as $langcode) {
$item = array(
'menu_name' => 'main-menu',
'link_path' => '<front>',
'link_title' => 'Menu item ' . strtoupper($langcode),
'langcode' => $langcode,
);
$this->items[] = menu_link_save($item);
}
// Create and log in admin user.
$this->adminUser = $this->backdropCreateUser(array(
'access administration pages',
'administer menu',
'administer nodes',
'bypass node access',
));
$this->backdropLogin($this->adminUser);
}