1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* Upgrade test for filter format identifiers.
|
5
|
*
|
6
|
* Filter format identifiers changed from sequential ids to machine names.
|
7
|
* Verify that filter formats and references to filter formats in core are
|
8
|
* converted properly.
|
9
|
*/
|
10
|
class FilterFormatUpgradePathTestCase extends UpgradePathTestCase {
|
11
|
public static function getInfo() {
|
12
|
return array(
|
13
|
'name' => 'Filter format upgrade path',
|
14
|
'description' => 'Verifies that filter formats and references to filter formats are converted properly.',
|
15
|
'group' => 'Upgrade path',
|
16
|
);
|
17
|
}
|
18
|
|
19
|
function setUp() {
|
20
|
// Path to the database dump.
|
21
|
$this->databaseDumpFiles = array(
|
22
|
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.filled.database.php',
|
23
|
);
|
24
|
parent::setUp();
|
25
|
}
|
26
|
|
27
|
/**
|
28
|
* Test a successful upgrade.
|
29
|
*/
|
30
|
function testFilterFormatUpgrade() {
|
31
|
$this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
|
32
|
|
33
|
$format = filter_format_load('1');
|
34
|
$this->assertTrue($format->format == '1', 'Filter format found.');
|
35
|
$format->format = 'test_filter';
|
36
|
$format->name = 'Test filter';
|
37
|
filter_format_save($format);
|
38
|
$format = filter_format_load('test_filter');
|
39
|
$this->assertTrue($format->format == 'test_filter', 'Saved a filter format with machine name.');
|
40
|
|
41
|
$account = user_load(4);
|
42
|
user_save($account, array('signature_format' => 'test_filter'));
|
43
|
$account = user_load(4);
|
44
|
$this->assertTrue($account->signature_format == 'test_filter', 'Signature format changed successfully to a filter format with machine name.');
|
45
|
|
46
|
$delta = db_insert('block_custom')
|
47
|
->fields(array(
|
48
|
'body' => 'Test block',
|
49
|
'info' => 'Test block',
|
50
|
'format' => 'test_filter',
|
51
|
))
|
52
|
->execute();
|
53
|
$this->assertTrue($delta > 0, 'Created a custom block using a filter format with machine name.');
|
54
|
}
|
55
|
}
|