diff --git a/modules/node/tests/node_access_test.install b/modules/node/tests/node_access_test.install new file mode 100644 index 00000000..3535ab19 --- /dev/null +++ b/modules/node/tests/node_access_test.install @@ -0,0 +1,84 @@ + 'The base table for node_access_test.', + 'fields' => array( + 'nid' => array( + 'description' => 'The {node}.nid this record affects.', + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'private' => array( + 'description' => 'Boolean indicating whether the node is private (visible to administrator) or not (visible to non-administrators).', + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + ), + ), + 'indexes' => array( + 'nid' => array('nid'), + ), + 'primary key' => array('nid'), + 'foreign keys' => array( + 'versioned_node' => array( + 'table' => 'node', + 'columns' => array('nid' => 'nid'), + ), + ), + ); + + return $schema; +} + 'The base table for node_access_test.', + 'fields' => array( + 'nid' => array( + 'description' => 'The {node}.nid this record affects.', + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'private' => array( + 'description' => 'Boolean indicating whether the node is private (visible to administrator) or not (visible to non-administrators).', + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + ), + ), + 'indexes' => array( + 'nid' => array('nid'), + ), + 'primary key' => array('nid'), + 'foreign keys' => array( + 'versioned_node' => array( + 'table' => 'node', + 'columns' => array('nid' => 'nid'), + ), + ), + ); + + return $schema; +} \ No newline at end of file diff --git a/modules/simpletest/tests/upgrade/drupal-6.menu.database.php b/modules/simpletest/tests/upgrade/drupal-6.menu.database.php new file mode 100644 index 00000000..d10c4eec --- /dev/null +++ b/modules/simpletest/tests/upgrade/drupal-6.menu.database.php @@ -0,0 +1,10 @@ +fields(array( + 'name', + 'value', +)) +->values(array( + 'name' => 'menu_default_node_menu', + 'value' => 's:15:"secondary-links";', +)) +->execute(); diff --git a/modules/simpletest/tests/upgrade/drupal-6.user-no-password-token.database.php b/modules/simpletest/tests/upgrade/drupal-6.user-no-password-token.database.php new file mode 100644 index 00000000..64631946 --- /dev/null +++ b/modules/simpletest/tests/upgrade/drupal-6.user-no-password-token.database.php @@ -0,0 +1,10 @@ +fields(array( + 'name', + 'value', +)) +->values(array( + 'name' => 'user_mail_register_no_approval_required_body', + 'value' => 's:86:"!username, !site, !uri, !uri_brief, !mailto, !date, !login_uri, !edit_uri, !login_url.";', +)) +->execute(); diff --git a/modules/simpletest/tests/upgrade/drupal-6.user-password-token.database.php b/modules/simpletest/tests/upgrade/drupal-6.user-password-token.database.php new file mode 100644 index 00000000..367c7048 --- /dev/null +++ b/modules/simpletest/tests/upgrade/drupal-6.user-password-token.database.php @@ -0,0 +1,10 @@ +fields(array( + 'name', + 'value', +)) +->values(array( + 'name' => 'user_mail_register_no_approval_required_body', + 'value' => 's:97:"!password, !username, !site, !uri, !uri_brief, !mailto, !date, !login_uri, !edit_uri, !login_url.";', +)) +->execute(); diff --git a/modules/simpletest/tests/upgrade/upgrade.menu.test b/modules/simpletest/tests/upgrade/upgrade.menu.test new file mode 100644 index 00000000..beb20277 --- /dev/null +++ b/modules/simpletest/tests/upgrade/upgrade.menu.test @@ -0,0 +1,44 @@ + 'Menu upgrade path', + 'description' => 'Menu upgrade path tests.', + 'group' => 'Upgrade path', + ); + } + + public function setUp() { + // Path to the database dump files. + $this->databaseDumpFiles = array( + drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.filled.database.php', + drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.menu.database.php', + ); + parent::setUp(); + + $this->uninstallModulesExcept(array('menu')); + } + + /** + * Test a successful upgrade. + */ + public function testMenuUpgrade() { + $this->assertTrue($this->performUpgrade(), t('The upgrade was completed successfully.')); + + // Test the migration of "Default menu for content" setting to individual node types. + $this->drupalGet("admin/structure/types/manage/page/edit"); + $this->assertNoFieldChecked('edit-menu-options-management', 'Management menu is not selected as available menu'); + $this->assertNoFieldChecked('edit-menu-options-navigation', 'Navigation menu is not selected as available menu'); + $this->assertNoFieldChecked('edit-menu-options-primary-links', 'Primary Links menu is not selected as available menu'); + $this->assertFieldChecked('edit-menu-options-secondary-links', 'Secondary Links menu is selected as available menu'); + $this->assertNoFieldChecked('edit-menu-options-user-menu', 'User menu is not selected as available menu'); + $this->assertOptionSelected('edit-menu-parent', 'secondary-links:0', 'Secondary links is selected as default parent item'); + + $this->assertEqual(variable_get('menu_default_node_menu'), NULL, 'Redundant variable menu_default_node_menu has been removed'); + + } +} diff --git a/modules/simpletest/tests/upgrade/upgrade.user.test b/modules/simpletest/tests/upgrade/upgrade.user.test new file mode 100644 index 00000000..6c669219 --- /dev/null +++ b/modules/simpletest/tests/upgrade/upgrade.user.test @@ -0,0 +1,60 @@ + 'User upgrade path (password token involved)', + 'description' => 'User upgrade path tests (password token involved).', + 'group' => 'Upgrade path', + ); + } + + public function setUp() { + // Path to the database dump files. + $this->databaseDumpFiles = array( + drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.bare.database.php', + drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.user-password-token.database.php', + ); + parent::setUp(); + } + + /** + * Test a successful upgrade. + */ + public function testUserUpgrade() { + $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.'); + $this->assertEqual(variable_get('user_mail_register_no_approval_required_body'), ', [user:name], [site:name], [site:url], [site:url-brief], [user:mail], [date:medium], [site:login-url], [user:edit-url], [user:one-time-login-url].', 'Existing email templates have been modified (password token involved).'); + } +} + +/** + * Upgrade test for user.module (password token not involved). + */ +class UserUpgradePathNoPasswordTokenTestCase extends UpgradePathTestCase { + public static function getInfo() { + return array( + 'name' => 'User upgrade path (password token not involved)', + 'description' => 'User upgrade path tests (password token not involved).', + 'group' => 'Upgrade path', + ); + } + + public function setUp() { + // Path to the database dump files. + $this->databaseDumpFiles = array( + drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.bare.database.php', + drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.user-no-password-token.database.php', + ); + parent::setUp(); + } + + /** + * Test a successful upgrade. + */ + public function testUserUpgrade() { + $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.'); + $this->assertEqual(variable_get('user_mail_register_no_approval_required_body'), '[user:name], [site:name], [site:url], [site:url-brief], [user:mail], [date:medium], [site:login-url], [user:edit-url], [user:one-time-login-url].', 'Existing email templates have been modified (password token not involved).'); + } +}