summaryrefslogtreecommitdiff
path: root/modules/simpletest/tests/upgrade
diff options
context:
space:
mode:
Diffstat (limited to 'modules/simpletest/tests/upgrade')
-rw-r--r--modules/simpletest/tests/upgrade/drupal-6.bare.database.php5
-rw-r--r--modules/simpletest/tests/upgrade/drupal-6.filled.database.php1
-rw-r--r--modules/simpletest/tests/upgrade/drupal-6.forum.database.php261
-rw-r--r--modules/simpletest/tests/upgrade/drupal-6.locale.database.php1
-rw-r--r--modules/simpletest/tests/upgrade/drupal-6.upload.database.php1
-rw-r--r--modules/simpletest/tests/upgrade/upgrade.comment.test1
-rw-r--r--modules/simpletest/tests/upgrade/upgrade.filter.test1
-rw-r--r--modules/simpletest/tests/upgrade/upgrade.forum.test61
-rw-r--r--modules/simpletest/tests/upgrade/upgrade.locale.test1
-rw-r--r--modules/simpletest/tests/upgrade/upgrade.node.test1
-rw-r--r--modules/simpletest/tests/upgrade/upgrade.poll.test1
-rw-r--r--modules/simpletest/tests/upgrade/upgrade.taxonomy.test1
-rw-r--r--modules/simpletest/tests/upgrade/upgrade.test1
-rw-r--r--modules/simpletest/tests/upgrade/upgrade.upload.test1
14 files changed, 324 insertions, 14 deletions
diff --git a/modules/simpletest/tests/upgrade/drupal-6.bare.database.php b/modules/simpletest/tests/upgrade/drupal-6.bare.database.php
index 7e78e1b99..40c75627a 100644
--- a/modules/simpletest/tests/upgrade/drupal-6.bare.database.php
+++ b/modules/simpletest/tests/upgrade/drupal-6.bare.database.php
@@ -1,5 +1,4 @@
<?php
-// $Id$
/**
* @file
@@ -7902,7 +7901,7 @@ db_insert('users')->fields(array(
'access' => '0',
'login' => '0',
'status' => '0',
- 'timezone' => NULL,
+ 'timezone' => '-21600',
'language' => '',
'picture' => '',
'init' => '',
@@ -7923,7 +7922,7 @@ db_insert('users')->fields(array(
'access' => '1277671612',
'login' => '1277671612',
'status' => '1',
- 'timezone' => NULL,
+ 'timezone' => '-21600',
'language' => '',
'picture' => '',
'init' => 'admin@example.com',
diff --git a/modules/simpletest/tests/upgrade/drupal-6.filled.database.php b/modules/simpletest/tests/upgrade/drupal-6.filled.database.php
index 7afa04442..a91628136 100644
--- a/modules/simpletest/tests/upgrade/drupal-6.filled.database.php
+++ b/modules/simpletest/tests/upgrade/drupal-6.filled.database.php
@@ -1,5 +1,4 @@
<?php
-// $Id$
/**
* @file
diff --git a/modules/simpletest/tests/upgrade/drupal-6.forum.database.php b/modules/simpletest/tests/upgrade/drupal-6.forum.database.php
new file mode 100644
index 000000000..07dfcb341
--- /dev/null
+++ b/modules/simpletest/tests/upgrade/drupal-6.forum.database.php
@@ -0,0 +1,261 @@
+<?php
+// $Id$
+
+/**
+ * Database additions for forum tests.
+ */
+
+db_create_table('forum', array(
+ 'fields' => array(
+ 'nid' => array(
+ 'type' => 'int',
+ 'unsigned' => TRUE,
+ 'not null' => TRUE,
+ 'default' => 0,
+ ),
+ 'vid' => array(
+ 'type' => 'int',
+ 'unsigned' => TRUE,
+ 'not null' => TRUE,
+ 'default' => 0,
+ ),
+ 'tid' => array(
+ 'type' => 'int',
+ 'unsigned' => TRUE,
+ 'not null' => TRUE,
+ 'default' => 0,
+ ),
+ ),
+ 'indexes' => array(
+ 'nid' => array(
+ 'nid',
+ ),
+ 'tid' => array(
+ 'tid',
+ ),
+ ),
+ 'primary key' => array(
+ 'vid',
+ ),
+ 'module' => 'forum',
+ 'name' => 'forum',
+));
+db_insert('forum')->fields(array(
+ 'nid',
+ 'vid',
+ 'tid',
+))
+->values(array(
+ 'nid' => '51',
+ 'vid' => '61',
+ 'tid' => '81',
+))
+->execute();
+
+db_insert('node')->fields(array(
+ 'nid',
+ 'vid',
+ 'type',
+ 'language',
+ 'title',
+ 'uid',
+ 'status',
+ 'created',
+ 'changed',
+ 'comment',
+ 'promote',
+ 'moderate',
+ 'sticky',
+ 'tnid',
+ 'translate',
+))
+->values(array(
+ 'nid' => '51',
+ 'vid' => '61',
+ 'type' => 'forum',
+ 'language' => '',
+ 'title' => 'Apples',
+ 'uid' => '1',
+ 'status' => '1',
+ 'created' => '1298363952',
+ 'changed' => '1298363952',
+ 'comment' => '2',
+ 'promote' => '0',
+ 'moderate' => '0',
+ 'sticky' => '0',
+ 'tnid' => '0',
+ 'translate' => '0',
+))
+->execute();
+
+db_insert('node_revisions')->fields(array(
+ 'nid',
+ 'vid',
+ 'uid',
+ 'title',
+ 'body',
+ 'teaser',
+ 'log',
+ 'timestamp',
+ 'format',
+))
+->values(array(
+ 'nid' => '51',
+ 'vid' => '61',
+ 'uid' => '1',
+ 'title' => 'Apples',
+ 'body' => 'A fruit.',
+ 'teaser' => 'A fruit.',
+ 'log' => '',
+ 'timestamp' => '1298363952',
+ 'format' => '1',
+))
+->execute();
+
+db_insert('node_comment_statistics')->fields(array(
+ 'nid',
+ 'last_comment_timestamp',
+ 'last_comment_name',
+ 'last_comment_uid',
+ 'comment_count',
+))
+->values(array(
+ 'nid' => '51',
+ 'last_comment_timestamp' => '1298363952',
+ 'last_comment_name' => NULL,
+ 'last_comment_uid' => '1',
+ 'comment_count' => '0',
+))
+->execute();
+
+db_insert('node_type')->fields(array(
+ 'type',
+ 'name',
+ 'module',
+ 'description',
+ 'help',
+ 'has_title',
+ 'title_label',
+ 'has_body',
+ 'body_label',
+ 'min_word_count',
+ 'custom',
+ 'modified',
+ 'locked',
+ 'orig_type',
+))
+->values(array(
+ 'type' => 'forum',
+ 'name' => 'Forum topic',
+ 'module' => 'forum',
+ 'description' => 'A <em>forum topic</em> is the initial post to a new discussion thread within a forum.',
+ 'help' => '',
+ 'has_title' => '1',
+ 'title_label' => 'Subject',
+ 'has_body' => '1',
+ 'body_label' => 'Body',
+ 'min_word_count' => '0',
+ 'custom' => '0',
+ 'modified' => '0',
+ 'locked' => '1',
+ 'orig_type' => 'forum',
+))
+->execute();
+
+db_update('system')->fields(array(
+ 'schema_version' => '6000',
+ 'status' => '1',
+))
+->condition('filename', 'modules/forum/forum.module')
+->execute();
+
+db_insert('term_data')->fields(array(
+ 'tid',
+ 'vid',
+ 'name',
+ 'description',
+ 'weight',
+))
+->values(array(
+ 'tid' => '81',
+ 'vid' => '101',
+ 'name' => 'Fruits',
+ 'description' => 'Fruits.',
+ 'weight' => '0',
+))
+->execute();
+
+db_insert('term_hierarchy')->fields(array(
+ 'tid',
+ 'parent',
+))
+->values(array(
+ 'tid' => '81',
+ 'parent' => '0',
+))
+->execute();
+
+db_insert('term_node')->fields(array(
+ 'nid',
+ 'vid',
+ 'tid',
+))
+->values(array(
+ 'nid' => '51',
+ 'vid' => '61',
+ 'tid' => '81',
+))
+->execute();
+
+db_insert('variable')->fields(array(
+ 'name',
+ 'value',
+))
+->values(array(
+ 'name' => 'forum_nav_vocabulary',
+ 'value' => 's:3:"101";',
+))
+->values(array(
+ 'name' => 'forum_containers',
+ 'value' => 'a:1:{i:0;s:3:"101";}',
+))
+->execute();
+
+db_insert('vocabulary')->fields(array(
+ 'vid',
+ 'name',
+ 'description',
+ 'help',
+ 'relations',
+ 'hierarchy',
+ 'multiple',
+ 'required',
+ 'tags',
+ 'module',
+ 'weight',
+))
+->values(array(
+ 'vid' => '101',
+ 'name' => 'Upgrade test for forums',
+ 'description' => 'Vocabulary used for Forums. The name is changed from the default "Forums" so that the upgrade path may be tested.',
+ 'help' => '',
+ 'relations' => '1',
+ 'hierarchy' => '1',
+ 'multiple' => '0',
+ 'required' => '0',
+ 'tags' => '0',
+ 'module' => 'forum',
+ 'weight' => '-10',
+))
+->execute();
+
+db_insert('vocabulary_node_types')->fields(array(
+ 'vid',
+ 'type',
+))
+->values(array(
+ 'vid' => '101',
+ 'type' => 'forum',
+))
+->execute();
+
diff --git a/modules/simpletest/tests/upgrade/drupal-6.locale.database.php b/modules/simpletest/tests/upgrade/drupal-6.locale.database.php
index d4ea09f73..c8af67121 100644
--- a/modules/simpletest/tests/upgrade/drupal-6.locale.database.php
+++ b/modules/simpletest/tests/upgrade/drupal-6.locale.database.php
@@ -1,5 +1,4 @@
<?php
-// $Id$
/**
* Database additions for locale tests.
diff --git a/modules/simpletest/tests/upgrade/drupal-6.upload.database.php b/modules/simpletest/tests/upgrade/drupal-6.upload.database.php
index 94733ed4c..493483f3d 100644
--- a/modules/simpletest/tests/upgrade/drupal-6.upload.database.php
+++ b/modules/simpletest/tests/upgrade/drupal-6.upload.database.php
@@ -1,5 +1,4 @@
<?php
-// $Id$
db_insert('files')->fields(array(
'fid',
diff --git a/modules/simpletest/tests/upgrade/upgrade.comment.test b/modules/simpletest/tests/upgrade/upgrade.comment.test
index db899427b..5fcf0b4b2 100644
--- a/modules/simpletest/tests/upgrade/upgrade.comment.test
+++ b/modules/simpletest/tests/upgrade/upgrade.comment.test
@@ -1,5 +1,4 @@
<?php
-// $Id$
/**
* Upgrade test for comment.module.
diff --git a/modules/simpletest/tests/upgrade/upgrade.filter.test b/modules/simpletest/tests/upgrade/upgrade.filter.test
index 732e757e7..86248b74c 100644
--- a/modules/simpletest/tests/upgrade/upgrade.filter.test
+++ b/modules/simpletest/tests/upgrade/upgrade.filter.test
@@ -1,5 +1,4 @@
<?php
-// $Id$
/**
* Upgrade test for filter format identifiers.
diff --git a/modules/simpletest/tests/upgrade/upgrade.forum.test b/modules/simpletest/tests/upgrade/upgrade.forum.test
new file mode 100644
index 000000000..827988dab
--- /dev/null
+++ b/modules/simpletest/tests/upgrade/upgrade.forum.test
@@ -0,0 +1,61 @@
+<?php
+// $Id$
+
+/**
+ * Upgrade test for forum.module.
+ */
+class ForumUpgradePathTestCase extends UpgradePathTestCase {
+ public static function getInfo() {
+ return array(
+ 'name' => 'Forum upgrade path',
+ 'description' => 'Upgrade path tests for the Forum module.',
+ '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.forum.database.php',
+ );
+ parent::setUp();
+
+ $this->uninstallModulesExcept(array('comment', 'forum', 'taxonomy'));
+ }
+
+ /**
+ * Test a successful upgrade (no negotiation).
+ */
+ public function testForumUpgrade() {
+ $this->assertTrue($this->performUpgrade(), t('The upgrade was completed successfully.'));
+
+ // Work around http://drupal.org/node/931512
+ $this->drupalPost('admin/structure/types/manage/forum/fields', array(), t('Save'));
+
+ // The D6 database forum vocabulary contains the term "Fruits" with id 81.
+ $tid = 81;
+ $this->drupalGet("forum/$tid");
+
+ // There is one forum topic in Fruits, with the title "Apples".
+ $this->clickLink('Apples');
+ $this->clickLink('Edit');
+
+ // Add a forum topic "Bananas" to the "Fruits" forum.
+ $edit = array(
+ 'title' => $title = 'Bananas',
+ 'body[' . LANGUAGE_NONE . '][0][value]' => $body = 'It is another fruit.',
+ );
+ $this->drupalPost("node/add/forum/$tid", $edit, t('Save'));
+ $type = t('Forum topic');
+ $this->assertRaw(t('@type %title has been created.', array('@type' => $type, '%title' => $title)), t('Forum topic was created'));
+
+ // Retrieve node object, ensure that the topic was created and in the proper forum.
+ $node = $this->drupalGetNodeByTitle($title);
+ $this->assertTrue($node != NULL, t('Node @title was loaded', array('@title' => $title)));
+ $this->assertEqual($node->taxonomy_forums[LANGUAGE_NONE][0]['tid'], $tid, 'Saved forum topic was in the expected forum');
+
+ $this->drupalGet("forum/$tid");
+ $this->assertText('Bananas');
+ }
+}
diff --git a/modules/simpletest/tests/upgrade/upgrade.locale.test b/modules/simpletest/tests/upgrade/upgrade.locale.test
index 66ea14e52..aec559de6 100644
--- a/modules/simpletest/tests/upgrade/upgrade.locale.test
+++ b/modules/simpletest/tests/upgrade/upgrade.locale.test
@@ -1,5 +1,4 @@
<?php
-// $Id$
/**
* Upgrade test for locale.module.
diff --git a/modules/simpletest/tests/upgrade/upgrade.node.test b/modules/simpletest/tests/upgrade/upgrade.node.test
index d2366b7f7..163dbef5e 100644
--- a/modules/simpletest/tests/upgrade/upgrade.node.test
+++ b/modules/simpletest/tests/upgrade/upgrade.node.test
@@ -1,5 +1,4 @@
<?php
-// $Id$
/**
* Upgrade test for node bodies.
diff --git a/modules/simpletest/tests/upgrade/upgrade.poll.test b/modules/simpletest/tests/upgrade/upgrade.poll.test
index 12aff8bd8..9bbbf90a4 100644
--- a/modules/simpletest/tests/upgrade/upgrade.poll.test
+++ b/modules/simpletest/tests/upgrade/upgrade.poll.test
@@ -1,5 +1,4 @@
<?php
-// $Id$
/**
* Upgrade test for poll.module.
diff --git a/modules/simpletest/tests/upgrade/upgrade.taxonomy.test b/modules/simpletest/tests/upgrade/upgrade.taxonomy.test
index 92db17e48..dadb98e5a 100644
--- a/modules/simpletest/tests/upgrade/upgrade.taxonomy.test
+++ b/modules/simpletest/tests/upgrade/upgrade.taxonomy.test
@@ -1,5 +1,4 @@
<?php
-// $Id$
/**
* Test taxonomy upgrades.
diff --git a/modules/simpletest/tests/upgrade/upgrade.test b/modules/simpletest/tests/upgrade/upgrade.test
index 263baff48..8a3da8188 100644
--- a/modules/simpletest/tests/upgrade/upgrade.test
+++ b/modules/simpletest/tests/upgrade/upgrade.test
@@ -1,5 +1,4 @@
<?php
-// $Id$
/**
* Perform end-to-end tests of the upgrade path.
diff --git a/modules/simpletest/tests/upgrade/upgrade.upload.test b/modules/simpletest/tests/upgrade/upgrade.upload.test
index a0402a38e..e3e1dc21e 100644
--- a/modules/simpletest/tests/upgrade/upgrade.upload.test
+++ b/modules/simpletest/tests/upgrade/upgrade.upload.test
@@ -1,5 +1,4 @@
<?php
-// $Id$
/**
* Upgrade test for comment.module.