Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
d2699d34
Commit
d2699d34
authored
Oct 31, 2012
by
Nathaniel Catchpole
Browse files
Adding a file missed in a previous commit.
parent
5f4e5d8d
Changes
1
Hide whitespace changes
Inline
Side-by-side
core/modules/system/lib/Drupal/system/Tests/Upgrade/BlockUpgradePathTest.php
0 → 100644
View file @
d2699d34
<?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.'
);
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment