1 |
85ad3d82
|
Assos Assos
|
<?php
|
2 |
|
|
|
3 |
|
|
/**
|
4 |
|
|
* Upgrade test for menu.module.
|
5 |
|
|
*/
|
6 |
|
|
class MenuUpgradePathTestCase extends UpgradePathTestCase {
|
7 |
|
|
public static function getInfo() {
|
8 |
|
|
return array(
|
9 |
|
|
'name' => 'Menu upgrade path',
|
10 |
|
|
'description' => 'Menu upgrade path tests.',
|
11 |
|
|
'group' => 'Upgrade path',
|
12 |
|
|
);
|
13 |
|
|
}
|
14 |
|
|
|
15 |
|
|
public function setUp() {
|
16 |
|
|
// Path to the database dump files.
|
17 |
|
|
$this->databaseDumpFiles = array(
|
18 |
|
|
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.filled.database.php',
|
19 |
|
|
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.menu.database.php',
|
20 |
|
|
);
|
21 |
|
|
parent::setUp();
|
22 |
|
|
|
23 |
|
|
$this->uninstallModulesExcept(array('menu'));
|
24 |
|
|
}
|
25 |
|
|
|
26 |
|
|
/**
|
27 |
|
|
* Test a successful upgrade.
|
28 |
|
|
*/
|
29 |
|
|
public function testMenuUpgrade() {
|
30 |
|
|
$this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
|
31 |
|
|
|
32 |
|
|
// Test the migration of "Default menu for content" setting to individual
|
33 |
|
|
// node types.
|
34 |
|
|
$this->drupalGet('admin/structure/types/manage/page/edit');
|
35 |
|
|
$this->assertNoFieldChecked('edit-menu-options-management', 'Management menu is not selected as available menu');
|
36 |
|
|
$this->assertNoFieldChecked('edit-menu-options-navigation', 'Navigation menu is not selected as available menu');
|
37 |
|
|
$this->assertNoFieldChecked('edit-menu-options-main-menu', 'Main menu is not selected as available menu');
|
38 |
|
|
$this->assertFieldChecked('edit-menu-options-secondary-menu', 'Secondary menu is selected as available menu');
|
39 |
|
|
$this->assertNoFieldChecked('edit-menu-options-user-menu', 'User menu is not selected as available menu');
|
40 |
|
|
$this->assertOptionSelected('edit-menu-parent', 'secondary-menu:0', 'Secondary menu is selected as default parent item');
|
41 |
|
|
|
42 |
|
|
$this->assertEqual(variable_get('menu_default_node_menu'), NULL, 'Redundant variable menu_default_node_menu has been removed');
|
43 |
|
|
|
44 |
|
|
// Verify Primary/Secondary Links have been renamed.
|
45 |
|
|
$this->drupalGet('admin/structure/menu');
|
46 |
|
|
$this->assertNoLinkByHref('admin/structure/menu/manage/primary-links');
|
47 |
|
|
$this->assertLinkByHref('admin/structure/menu/manage/main-menu');
|
48 |
|
|
$this->assertNoLinkByHref('admin/structure/menu/manage/secondary-links');
|
49 |
|
|
$this->assertLinkByHref('admin/structure/menu/manage/secondary-menu');
|
50 |
|
|
|
51 |
|
|
// Verify the existence of all system-defined (default) menus.
|
52 |
|
|
foreach (menu_list_system_menus() as $menu_name => $title) {
|
53 |
|
|
$this->assertLinkByHref('admin/structure/menu/manage/' . $menu_name, 0, 'Found default menu: ' . $title);
|
54 |
|
|
}
|
55 |
|
|
|
56 |
|
|
// Verify a few known links are still present, plus the ones created here.
|
57 |
|
|
$test_menus = array(
|
58 |
|
|
'navigation' => array('Add content', 'nodeadd-navigation'),
|
59 |
|
|
'management' => array('Administration', 'Account settings'),
|
60 |
|
|
'user-menu' => array('My account', 'Log out'),
|
61 |
|
|
'main-menu' => array('nodeadd-primary'),
|
62 |
|
|
'secondary-menu' => array('nodeadd-secondary'),
|
63 |
|
|
);
|
64 |
|
|
|
65 |
|
|
foreach ($test_menus as $menu_name => $links) {
|
66 |
|
|
$this->drupalGet('admin/structure/menu/manage/' . $menu_name);
|
67 |
|
|
$this->assertResponse(200, 'Access menu management for ' . $menu_name);
|
68 |
|
|
foreach ($links as $link_text) {
|
69 |
|
|
$this->assertLink(t($link_text));
|
70 |
|
|
}
|
71 |
|
|
}
|
72 |
|
|
|
73 |
|
|
// Check the "source for primary/secondary links" setting.
|
74 |
|
|
$this->drupalGet('admin/structure/menu/settings');
|
75 |
|
|
$this->assertOptionSelected('edit-menu-main-links-source', 'secondary-menu');
|
76 |
|
|
$this->assertOptionSelected('edit-menu-secondary-links-source', 'main-menu');
|
77 |
|
|
|
78 |
|
|
// Check that both primary/secondary links blocks are visible.
|
79 |
|
|
$this->drupalGet('node');
|
80 |
|
|
$this->assertText('My Primary Links', '(Formerly) Primary Links block is still visible');
|
81 |
|
|
$this->assertText('My Secondary Links', '(Formerly) Secondary Links block is still visible');
|
82 |
|
|
}
|
83 |
|
|
} |