function BlockAccessConfigSpecificTestCase::testConfigOperations in Block Access 7
Test all config-specific operations
File
- tests/
op_config.test, line 53 - Tests for block_access / config-specific operations (config_lang, config_title etc)
Class
- BlockAccessConfigSpecificTestCase
- Tests for block_access / config-specific operations (config_lang, config_title etc)
Code
function testConfigOperations() {
// For each operation (config_lang, config_title, etc)
foreach ($this
->getConfigOperations() as $field => $op) {
// Restrict operation to $user1
$this
->drupalLogin($this->admin);
$this
->setBlockAccessPerm($this->block, $this->role1, $op, TRUE);
$this
->setBlockAccessPerm($this->block, $this->role2, $op, FALSE);
$this
->drupalGet('admin/structure/block/manage/block/' . $this->block->delta . '/configure');
// Verify $user1 is granted operation
$this
->drupalLogin($this->user1);
$this
->drupalGet('admin/structure/block/manage/block/' . $this->block->delta . '/configure');
$this
->assertResponse(200);
$this
->assertField($field, t('Found field for operation %op', array(
'%op' => $op,
)));
// Verify $user2 is not granted operation
$this
->drupalLogin($this->user2);
$this
->drupalGet('admin/structure/block/manage/block/' . $this->block->delta . '/configure');
$this
->assertResponse(200);
$this
->assertNoField($field, t('Could not find field for operation %op', array(
'%op' => $op,
)));
}
}