public function BlockAttributesTestCase::assertUpdateDisplayBlockAttributes in Block Attributes 7
Update Block Attributes and assert whether they are found when displayed.
Parameters
bool $anon: (optional) Set to TRUE to view block with anon user, defaults to TRUE.
string $module: (optional) Machine name of the module Defaults to $this->module if set to NULL.
string $delta: (optional) Block delta as provided by its module. Defaults to $this->delta if set to NULL.
3 calls to BlockAttributesTestCase::assertUpdateDisplayBlockAttributes()
- BlockAttributesFeaturesTestCase::testFeatureDisplayAttributes in ./
block_attributes.test - Test how Block Attributes reacts when exported to a Feature with FE Block.
- BlockAttributesMenuBlockTestCase::testMenuBlockDisplayAttributes in ./
block_attributes.test - Create, update and display a Menu Block to ensure attributes are found.
- BlockAttributesUpdateDisplayTestCase::testUpdateDisplayAttributes in ./
block_attributes.test - Update and display a Block multiple times to ensure attributes are found.
File
- ./
block_attributes.test, line 179 - Test the Block Attributes module.
Class
- BlockAttributesTestCase
- Provides common functionality for the Block Attributes test classes.
Code
public function assertUpdateDisplayBlockAttributes($anon = FALSE, $module = NULL, $delta = NULL) {
// Initialize $module and $delta by default if no value is provided.
if (!isset($module)) {
$module = $this->module;
}
if (!isset($delta)) {
$delta = $this->delta;
}
// Get Block Attributes testing data.
$block_attributes = $this
->getBlockAttributesTestingData();
// Update Block Attributes fields.
$this
->drupalPost("admin/structure/block/manage/{$module}/{$delta}/configure", $block_attributes, t('Save block'));
// Check Block configuration was saved successfully.
$this
->assertText(t('The block configuration has been saved.'));
// Log out if the test is for anonymous user.
if ($anon) {
$this
->drupalLogout();
}
// Browse to the homepage.
$this
->drupalGet('');
// Assert whether Block's attributes could be found on the page.
$this
->assertBlockAttributesDisplay($block_attributes);
// Login again after testing with the anonymous user.
if ($anon) {
$this
->drupalLogin($this->privilegedUser);
}
}