1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* Upgrade test for forum.module.
|
5
|
*/
|
6
|
class ForumUpgradePathTestCase extends UpgradePathTestCase {
|
7
|
public static function getInfo() {
|
8
|
return array(
|
9
|
'name' => 'Forum upgrade path',
|
10
|
'description' => 'Upgrade path tests for the Forum module.',
|
11
|
'group' => 'Upgrade path',
|
12
|
);
|
13
|
}
|
14
|
|
15
|
public function setUp() {
|
16
|
// Path to the database dump files.
|
17
|
$this->databaseDumpFiles = array(
|
18
|
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.filled.database.php',
|
19
|
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.forum.database.php',
|
20
|
);
|
21
|
parent::setUp();
|
22
|
|
23
|
$this->uninstallModulesExcept(array('comment', 'forum', 'taxonomy'));
|
24
|
}
|
25
|
|
26
|
/**
|
27
|
* Test a successful upgrade (no negotiation).
|
28
|
*/
|
29
|
public function testForumUpgrade() {
|
30
|
$this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
|
31
|
|
32
|
// Work around http://drupal.org/node/931512
|
33
|
$this->drupalPost('admin/structure/types/manage/forum/fields', array(), t('Save'));
|
34
|
|
35
|
// The D6 database forum vocabulary contains the term "Fruits" with id 81.
|
36
|
$tid = 81;
|
37
|
$this->drupalGet("forum/$tid");
|
38
|
|
39
|
// There is one forum topic in Fruits, with the title "Apples".
|
40
|
$this->clickLink('Apples');
|
41
|
$this->clickLink('Edit');
|
42
|
|
43
|
// Add a forum topic "Bananas" to the "Fruits" forum.
|
44
|
$edit = array(
|
45
|
'title' => $title = 'Bananas',
|
46
|
'body[' . LANGUAGE_NONE . '][0][value]' => $body = 'It is another fruit.',
|
47
|
);
|
48
|
$this->drupalPost("node/add/forum/$tid", $edit, t('Save'));
|
49
|
$type = t('Forum topic');
|
50
|
$this->assertRaw(t('@type %title has been created.', array('@type' => $type, '%title' => $title)), 'Forum topic was created');
|
51
|
|
52
|
// Retrieve node object, ensure that the topic was created and in the proper forum.
|
53
|
$node = $this->drupalGetNodeByTitle($title);
|
54
|
$this->assertTrue($node != NULL, format_string('Node @title was loaded', array('@title' => $title)));
|
55
|
$this->assertEqual($node->taxonomy_forums[LANGUAGE_NONE][0]['tid'], $tid, 'Saved forum topic was in the expected forum');
|
56
|
|
57
|
$this->drupalGet("forum/$tid");
|
58
|
$this->assertText('Bananas');
|
59
|
$this->drupalLogout();
|
60
|
|
61
|
$this->drupalGet("node/add/forum/$tid");
|
62
|
$this->assertResponse(200, 'User can access forum creation page.');
|
63
|
}
|
64
|
}
|