upgrade.user.test 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /**
  3. * Upgrade test for user.module (password token involved).
  4. */
  5. class UserUpgradePathPasswordTokenTestCase extends UpgradePathTestCase {
  6. public static function getInfo() {
  7. return array(
  8. 'name' => 'User upgrade path (password token involved)',
  9. 'description' => 'User upgrade path tests (password token involved).',
  10. 'group' => 'Upgrade path',
  11. );
  12. }
  13. public function setUp() {
  14. // Path to the database dump files.
  15. $this->databaseDumpFiles = array(
  16. drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.bare.database.php',
  17. drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.user-password-token.database.php',
  18. );
  19. parent::setUp();
  20. }
  21. /**
  22. * Test a successful upgrade.
  23. */
  24. public function testUserUpgrade() {
  25. $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
  26. $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).');
  27. // Check that a non-md5 hash was untouched.
  28. $pass = db_query('SELECT pass FROM {users} WHERE uid = 3')->fetchField();
  29. $this->assertEqual('$S$DAK00p3Dkojkf4O/UizYxenguXnjv', $pass, 'Pre-existing non-MD5 password hash was not altered');
  30. }
  31. }
  32. /**
  33. * Upgrade test for user.module (password token not involved).
  34. */
  35. class UserUpgradePathNoPasswordTokenTestCase extends UpgradePathTestCase {
  36. public static function getInfo() {
  37. return array(
  38. 'name' => 'User upgrade path (password token not involved)',
  39. 'description' => 'User upgrade path tests (password token not involved).',
  40. 'group' => 'Upgrade path',
  41. );
  42. }
  43. public function setUp() {
  44. // Path to the database dump files.
  45. $this->databaseDumpFiles = array(
  46. drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.bare.database.php',
  47. drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.user-no-password-token.database.php',
  48. );
  49. parent::setUp();
  50. }
  51. /**
  52. * Test a successful upgrade.
  53. */
  54. public function testUserUpgrade() {
  55. $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
  56. $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).');
  57. }
  58. }