You are here

function BlockAccessTestCase::createBlock in Block Access 7

Helper - creates a block

9 calls to BlockAccessTestCase::createBlock()
BlockAccessConfigSpecificTestCase::setUp in tests/op_config.test
Sets up a Drupal site for running functional and integration tests.
BlockAccessConfigTestCase::setUp in tests/op_basic_config.test
Sets up a Drupal site for running functional and integration tests.
BlockAccessDeleteTestCase::setUp in tests/op_basic_delete.test
Sets up a Drupal site for running functional and integration tests.
BlockAccessDisableTestCase::setUp in tests/op_basic_disable.test
Sets up a Drupal site for running functional and integration tests.
BlockAccessEnableTestCase::setUp in tests/op_basic_enable.test
Sets up a Drupal site for running functional and integration tests.

... See full list

File

tests/common.test, line 102
Tests for block_access - common methods

Class

BlockAccessTestCase
Tests for block_access - common methods

Code

function createBlock($region = BLOCK_REGION_NONE) {
  $theme = variable_get('theme_custom', 'bartik');
  $edit = array();
  $edit['info'] = $this
    ->randomName(8);
  $edit['title'] = $this
    ->randomName(8);
  $edit['body[value]'] = $this
    ->randomName(32);
  $edit["regions[{$theme}]"] = $region;
  $this
    ->drupalPost('admin/structure/block/add', $edit, t('Save block'));
  $this
    ->assertResponse(200);
  $bid = db_query('SELECT bid FROM {block_custom} WHERE info = :info', array(
    ':info' => $edit['info'],
  ))
    ->fetchField();
  return block_load('block', $bid);
}