function BlockCacheAlter::_createTestBlock in Block Cache Alter 6
Helper function to create a test block.
Return value
array $block All properties of testblock.
3 calls to BlockCacheAlter::_createTestBlock()
- BlockCacheAlter::testPatchedBlockModule in ./
blockcache_alter.test - Extra tests when the block module is patched.
- BlockCacheAlter::testSimpleCacheChanges in ./
blockcache_alter.test - Test simple cache changes.
- BlockCacheAlter::testSimpleCacheRefreshments in ./
blockcache_alter.test - Test simple cache changes with clear cache option (only block or page).
File
- ./
blockcache_alter.test, line 40 - Tests for Block Cache Alter
Class
- BlockCacheAlter
- @file Tests for Block Cache Alter
Code
function _createTestBlock() {
// Add a new box by filling out the input form on the admin/build/block/add page.
$box = array();
$box['info'] = $this
->randomName(8);
$box['title'] = $this
->randomName(8);
$box['body'] = $this
->randomName(32);
$this
->drupalPost('admin/build/block/add', $box, t('Save block'));
// Confirm that the box has been created, and then query the created bid.
$this
->assertText(t('The block has been created.'), t('Box successfully created.'));
$bid = db_result(db_query("SELECT bid FROM {boxes} WHERE info = '%s'", array(
$box['info'],
)));
$delta = db_result(db_query("SELECT bid FROM {boxes} WHERE bid = %d", $bid));
// Check to see if the box was created by checking that it's in the database..
$this
->assertNotNull($bid, t('Box found in database'));
$box['bid'] = $bid;
$box['delta'] = $delta;
return $box;
}