Skip to content

Commit

Permalink
files pending from the update
Browse files Browse the repository at this point in the history
  • Loading branch information
cdavid committed Jul 4, 2011
1 parent 418997e commit 8fd5793
Show file tree
Hide file tree
Showing 6 changed files with 218 additions and 0 deletions.
84 changes: 84 additions & 0 deletions modules/node/tests/node_access_test.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?php

/**
* @file
* Install, update and uninstall functions for the node_access_test module.
*/

/**
* Implements hook_schema().
*/
function node_access_test_schema() {
$schema['node_access_test'] = array(
'description' => '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;
}
<?php

/**
* @file
* Install, update and uninstall functions for the node_access_test module.
*/

/**
* Implements hook_schema().
*/
function node_access_test_schema() {
$schema['node_access_test'] = array(
'description' => '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;
}
10 changes: 10 additions & 0 deletions modules/simpletest/tests/upgrade/drupal-6.menu.database.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php
db_insert('variable')->fields(array(
'name',
'value',
))
->values(array(
'name' => 'menu_default_node_menu',
'value' => 's:15:"secondary-links";',
))
->execute();
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php
db_insert('variable')->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();
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php
db_insert('variable')->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();
44 changes: 44 additions & 0 deletions modules/simpletest/tests/upgrade/upgrade.menu.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

/**
* Upgrade test for menu.module.
*/
class MenuUpgradePathTestCase extends UpgradePathTestCase {
public static function getInfo() {
return array(
'name' => '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');

}
}
60 changes: 60 additions & 0 deletions modules/simpletest/tests/upgrade/upgrade.user.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php
/**
* Upgrade test for user.module (password token involved).
*/
class UserUpgradePathPasswordTokenTestCase extends UpgradePathTestCase {
public static function getInfo() {
return array(
'name' => '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).');
}
}

0 comments on commit 8fd5793

Please sign in to comment.