Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
/**
* @file
* Definition of Drupal\system\Tests\Upgrade\BlockUpgradePathTest.
*/
namespace Drupal\system\Tests\Upgrade;
/**
* Tests upgrading a bare database.
*
* Loads a bare installation of Drupal 7 and runs the upgrade process on it.
*/
class BlockUpgradePathTest extends UpgradePathTestBase {
public static function getInfo() {
return array(
'name' => 'Block upgrade test',
'description' => 'Upgrade tests with block data.',
'group' => 'Upgrade path',
);
}
public function setUp() {
$this->databaseDumpFiles = array(
drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.bare.minimal.database.php.gz',
);
parent::setUp();
}
/**
* Tests block title length after successful upgrade.
*/
public function testBlockUpgradeTitleLength() {
$this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
// Add a new custom block with a title of 255 characters.
$block_title_1 = $this->randomName(255);
$custom_block_1 = array();
$custom_block_1['title'] = $block_title_1;
$custom_block_1['info'] = $this->randomName(8);
$custom_block_1['body[value]'] = $this->randomName(32);
$custom_block_1['regions[bartik]'] = 'sidebar_first';
$this->drupalPost('admin/structure/block/add', $custom_block_1, t('Save block'));
// Confirm that the custom block has been created, and title matches input.
$this->drupalGet('');
$this->assertText($block_title_1, 'Block with title longer than 64 characters successfully created.');
// Add a new custom block with a title over 255 characters.
$block_title_2 = $this->randomName(256);
$custom_block_2 = array();
$custom_block_2['title'] = $block_title_2;
$custom_block_2['info'] = $this->randomName(8);
$custom_block_2['body[value]'] = $this->randomName(32);
$this->drupalPost('admin/structure/block/add', $custom_block_2, t('Save block'));
// Confirm that the custom block cannot be created with title longer than
// the maximum number of characters.
$this->assertText('Block title cannot be longer than 255 characters', 'Block with title longer than 255 characters created unsuccessfully.');
}
}