diff options
Diffstat (limited to 'modules/simpletest/tests/upgrade')
10 files changed, 331 insertions, 6 deletions
diff --git a/modules/simpletest/tests/upgrade/drupal-6.trigger.database.php b/modules/simpletest/tests/upgrade/drupal-6.trigger.database.php new file mode 100644 index 000000000..0962f3582 --- /dev/null +++ b/modules/simpletest/tests/upgrade/drupal-6.trigger.database.php @@ -0,0 +1,82 @@ +<?php +/** + * @file + * Test content for the trigger upgrade path. + */ +db_create_table('trigger_assignments', array( + 'fields' => array( + 'hook' => array( + 'type' => 'varchar', + 'length' => 32, + 'not null' => TRUE, + 'default' => '', + ), + 'op' => array( + 'type' => 'varchar', + 'length' => 32, + 'not null' => TRUE, + 'default' => '', + ), + 'aid' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + ), + 'weight' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + ), + ), + 'primary key' => array('hook', 'op', 'aid'), + 'module' => 'trigger', + 'name' => 'trigger_assignments', +)); + + +// Add several trigger configurations. +db_insert('trigger_assignments')->fields(array( + 'hook', + 'op', + 'aid', + 'weight', +)) +->values(array( + 'hook' => 'node', + 'op' => 'presave', + 'aid' => 'node_publish_action', + 'weight' => '1', +)) +->values(array( + 'hook' => 'comment', + 'op' => 'presave', + 'aid' => 'comment_publish_action', + 'weight' => '1', +)) +->values(array( + 'hook' => 'comment_delete', + 'op' => 'presave', + 'aid' => 'node_save_action', + 'weight' => '1', +)) +->values(array( + 'hook' => 'nodeapi', + 'op' => 'presave', + 'aid' => 'node_make_sticky_action', + 'weight' => '1', +)) +->values(array( + 'hook' => 'nodeapi', + 'op' => 'somehow_nodeapi_got_a_very_long', + 'aid' => 'node_save_action', + 'weight' => '1', +)) +->execute(); + +db_update('system')->fields(array( + 'schema_version' => '6000', + 'status' => '1', +)) +->condition('filename', 'modules/trigger/trigger.module') +->execute(); diff --git a/modules/simpletest/tests/upgrade/drupal-6.upload.database.php b/modules/simpletest/tests/upgrade/drupal-6.upload.database.php index 493483f3d..c7f032ecb 100644 --- a/modules/simpletest/tests/upgrade/drupal-6.upload.database.php +++ b/modules/simpletest/tests/upgrade/drupal-6.upload.database.php @@ -114,6 +114,19 @@ db_insert('files')->fields(array( 'status' => '1', 'timestamp' => '1285708957', )) +/* + * This is a case where the path is repeated twice. + */ +->values(array( + 'fid' => '11', + 'uid' => '1', + 'filename' => 'crazy-basename.png', + 'filepath' => '/drupal-6/file/directory/path/drupal-6/file/directory/path/crazy-basename.png', + 'filemime' => 'image/png', + 'filesize' => '329', + 'status' => '1', + 'timestamp' => '1285708958', +)) ->execute(); db_insert('node')->fields(array( @@ -235,8 +248,8 @@ db_insert('node_revisions')->fields(array( 'vid' => '53', 'uid' => '1', 'title' => 'node title 40 revision 53', - 'body' => "Attachments:\r\nforum-hot-new.png\r\nforum-hot.png\r\nforum-sticky.png\r\nforum-new.png", - 'teaser' => "Attachments:\r\nforum-hot-new.png\r\nforum-hot.png\r\nforum-sticky.png\r\nforum-new.png", + 'body' => "Attachments:\r\nforum-hot-new.png\r\nforum-hot.png\r\nforum-sticky.png\r\nforum-new.png\r\ncrazy-basename.png", + 'teaser' => "Attachments:\r\nforum-hot-new.png\r\nforum-hot.png\r\nforum-sticky.png\r\nforum-new.png\r\ncrazy-basename.png", 'log' => '', 'timestamp' => '1285709012', 'format' => '1', @@ -394,4 +407,12 @@ db_insert('upload')->fields(array( 'list' => '1', 'weight' => '-1', )) +->values(array( + 'fid' => '11', + 'nid' => '40', + 'vid' => '53', + 'description' => 'crazy-basename.png', + 'list' => '1', + 'weight' => '0', +)) ->execute(); diff --git a/modules/simpletest/tests/upgrade/drupal-7.field.database.php b/modules/simpletest/tests/upgrade/drupal-7.field.database.php new file mode 100644 index 000000000..630476133 --- /dev/null +++ b/modules/simpletest/tests/upgrade/drupal-7.field.database.php @@ -0,0 +1,16 @@ +<?php + +/** + * @file + * Test content for the field update path. + */ + +db_insert('variable')->fields(array( + 'name', + 'value', +)) +->values(array( + 'name' => 'field_bundle_settings', + 'value' => 'a:1:{s:4:"node";a:1:{s:4:"poll";a:1:{s:12:"extra_fields";a:1:{s:7:"display";a:2:{s:16:"poll_view_voting";a:1:{s:7:"default";a:2:{s:6:"weight";s:1:"0";s:7:"visible";b:1;}}s:17:"poll_view_results";a:1:{s:7:"default";a:2:{s:6:"weight";s:1:"0";s:7:"visible";b:0;}}}}}}}', +)) +->execute(); diff --git a/modules/simpletest/tests/upgrade/drupal-7.trigger.database.php b/modules/simpletest/tests/upgrade/drupal-7.trigger.database.php new file mode 100644 index 000000000..996f711dc --- /dev/null +++ b/modules/simpletest/tests/upgrade/drupal-7.trigger.database.php @@ -0,0 +1,28 @@ +<?php +/** + * @file + * Test content for the trigger upgrade path. + */ + +// Add several trigger configurations. +db_insert('trigger_assignments')->fields(array( + 'hook', + 'aid', + 'weight', +)) +->values(array( + 'hook' => 'node_presave', + 'aid' => 'node_publish_action', + 'weight' => '1', +)) +->values(array( + 'hook' => 'comment_presave', + 'aid' => 'comment_publish_action', + 'weight' => '1', +)) +->values(array( + 'hook' => 'comment_delete', + 'aid' => 'node_save_action', + 'weight' => '1', +)) +->execute(); diff --git a/modules/simpletest/tests/upgrade/update.field.test b/modules/simpletest/tests/upgrade/update.field.test new file mode 100644 index 000000000..60d6ae8d9 --- /dev/null +++ b/modules/simpletest/tests/upgrade/update.field.test @@ -0,0 +1,61 @@ +<?php + +/** + * @file + * Provides update path tests for the Field module. + */ + +/** + * Tests the Field 7.0 -> 7.x update path. + */ +class FieldUpdatePathTestCase extends UpdatePathTestCase { + public static function getInfo() { + return array( + 'name' => 'Field update path', + 'description' => 'Field update path tests.', + 'group' => 'Upgrade path', + ); + } + + public function setUp() { + // Use the filled update path and our field data. + $path = drupal_get_path('module', 'simpletest') . '/tests/upgrade'; + $this->databaseDumpFiles = array( + $path . '/drupal-7.filled.standard_all.database.php.gz', + $path . '/drupal-7.field.database.php', + ); + parent::setUp(); + + // Our test data includes poll extra field settings. + $this->uninstallModulesExcept(array('field', 'poll')); + } + + /** + * Tests that the update is successful. + */ + public function testFilledUpgrade() { + $this->assertTrue($this->performUpgrade(), t('The update was completed successfully.')); + $expected_settings = array( + 'extra_fields' => array( + 'display' => array( + 'poll_view_voting' => array( + 'default' => array( + 'weight' => '0', + 'visible' => TRUE, + ), + ), + 'poll_view_results' => array( + 'default' => array( + 'weight' => '0', + 'visible' => FALSE, + ), + ), + ), + 'form' => array(), + ), + 'view_modes' => array(), + ); + $actual_settings = field_bundle_settings('node', 'poll'); + $this->assertEqual($expected_settings, $actual_settings, 'Settings stored in field_bundle_settings were updated to per-bundle settings.'); + } +} diff --git a/modules/simpletest/tests/upgrade/update.trigger.test b/modules/simpletest/tests/upgrade/update.trigger.test new file mode 100644 index 000000000..a91f7b9d8 --- /dev/null +++ b/modules/simpletest/tests/upgrade/update.trigger.test @@ -0,0 +1,37 @@ +<?php +/** + * @file + * Provides upgrade path tests for the Trigger module. + */ + +/** + * Tests the Trigger 7.0 -> 7.x upgrade path. + */ +class TriggerUpdatePathTestCase extends UpdatePathTestCase { + public static function getInfo() { + return array( + 'name' => 'Trigger update path', + 'description' => 'Trigger update path tests.', + 'group' => 'Upgrade path', + ); + } + + public function setUp() { + // Use the filled upgrade path and our trigger data. + $this->databaseDumpFiles = array( + drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-7.filled.standard_all.database.php.gz', + drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-7.trigger.database.php', + ); + parent::setUp(); + + // Our test data includes node and comment trigger assignments. + $this->uninstallModulesExcept(array('comment', 'trigger')); + } + + /** + * Tests that the upgrade is successful. + */ + public function testFilledUpgrade() { + $this->assertTrue($this->performUpgrade(), t('The upgrade was completed successfully.')); + } +} diff --git a/modules/simpletest/tests/upgrade/update.user.test b/modules/simpletest/tests/upgrade/update.user.test new file mode 100644 index 000000000..4993139a4 --- /dev/null +++ b/modules/simpletest/tests/upgrade/update.user.test @@ -0,0 +1,35 @@ +<?php + +/** + * @file + * Provides update path tests for the User module. + */ + +/** + * Tests the User 7.0 -> 7.x update path. + */ +class UserUpdatePathTestCase extends UpdatePathTestCase { + public static function getInfo() { + return array( + 'name' => 'User update path', + 'description' => 'User update path tests.', + 'group' => 'Upgrade path', + ); + } + + public function setUp() { + // Use the filled update path and our field data. + $this->databaseDumpFiles = array( + drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-7.filled.standard_all.database.php.gz', + ); + parent::setUp(); + } + + /** + * Tests that the update is successful. + */ + public function testFilledUpgrade() { + $this->assertTrue($this->performUpgrade(), t('The update was completed successfully.')); + $this->assertTrue(db_index_exists('users', 'picture'), 'The {users}.picture column has an index.'); + } +} diff --git a/modules/simpletest/tests/upgrade/upgrade.test b/modules/simpletest/tests/upgrade/upgrade.test index 2602b09a2..172f30e69 100644 --- a/modules/simpletest/tests/upgrade/upgrade.test +++ b/modules/simpletest/tests/upgrade/upgrade.test @@ -549,7 +549,7 @@ class BasicStandardUpdatePath extends UpdatePathTestCase { )); // Test that the site name is correctly displayed. - $this->assertText('drupal', t('The site name is correctly displayed.')); + $this->assertText('Drupal', t('The site name is correctly displayed.')); // Verify that the main admin sections are available. $this->drupalGet('admin'); @@ -625,7 +625,7 @@ class BasicMinimalUpdatePath extends UpdatePathTestCase { )); // Test that the site name is correctly displayed. - $this->assertText('drupal', t('The site name is correctly displayed.')); + $this->assertText('Drupal', t('The site name is correctly displayed.')); // Verify that the main admin sections are available. $this->drupalGet('admin'); @@ -702,7 +702,7 @@ class FilledStandardUpdatePath extends UpdatePathTestCase { )); // Test that the site name is correctly displayed. - $this->assertText('drupal', t('The site name is correctly displayed.')); + $this->assertText('Drupal', t('The site name is correctly displayed.')); // Verify that the main admin sections are available. $this->drupalGet('admin'); @@ -778,7 +778,7 @@ class FilledMinimalUpdatePath extends UpdatePathTestCase { )); // Test that the site name is correctly displayed. - $this->assertText('drupal', t('The site name is correctly displayed.')); + $this->assertText('Drupal', t('The site name is correctly displayed.')); // Verify that the main admin sections are available. $this->drupalGet('admin'); diff --git a/modules/simpletest/tests/upgrade/upgrade.trigger.test b/modules/simpletest/tests/upgrade/upgrade.trigger.test new file mode 100644 index 000000000..7413bed52 --- /dev/null +++ b/modules/simpletest/tests/upgrade/upgrade.trigger.test @@ -0,0 +1,39 @@ +<?php +/** + * @file + * Provides upgrade path tests for the Trigger module. + */ + +/** + * Tests the Trigger 6 -> 7 upgrade path. + */ +class UpgradePathTriggerTestCase extends UpgradePathTestCase { + public static function getInfo() { + return array( + 'name' => 'Trigger upgrade path', + 'description' => 'Trigger upgrade path tests for Drupal 6.x.', + 'group' => 'Upgrade path', + ); + } + + public function setUp() { + // Path to the database dump. + $this->databaseDumpFiles = array( + drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.filled.database.php', + drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.trigger.database.php', + ); + parent::setUp(); + } + + /** + * Basic tests for the trigger upgrade. + */ + public function testTaxonomyUpgrade() { + $this->assertTrue($this->performUpgrade(), t('The upgrade was completed successfully.')); + $this->drupalGet('admin/structure/trigger/node'); + $this->assertRaw('<td>'. t('Make post sticky') .'</td>'); + $this->assertRaw('<td>'. t('Publish post') .'</td>'); + $this->drupalGet('admin/structure/trigger/comment'); + $this->assertRaw('<td>'. t('Publish comment') .'</td>'); + } +} diff --git a/modules/simpletest/tests/upgrade/upgrade.upload.test b/modules/simpletest/tests/upgrade/upgrade.upload.test index e3e1dc21e..276fae4e1 100644 --- a/modules/simpletest/tests/upgrade/upgrade.upload.test +++ b/modules/simpletest/tests/upgrade/upgrade.upload.test @@ -64,6 +64,12 @@ class UploadUpgradePathTestCase extends UpgradePathTestCase { } $this->assertIdentical($filenames, $recorded_filenames, 'The uploaded files are present in the same order after the upgrade.'); } + // Test for the file with repeating basename to only have the streaming + // path replaced. + $node = node_load(40, 53); + $repeated_basename_file = $node->upload[LANGUAGE_NONE][4]; + $this->assertEqual($repeated_basename_file['uri'], 'private://drupal-6/file/directory/path/crazy-basename.png', "The file with the repeated basename path only had the stream portion replaced"); + // Make sure the file settings were properly migrated. $d6_file_directory_temp = '/drupal-6/file/directory/temp'; $d6_file_directory_path = '/drupal-6/file/directory/path'; |