You are here

protected function AuthcacheBlockTest::createCustomBlock in Authenticated User Page Caching (Authcache) 7.2

Utility function: Create new custom block.

6 calls to AuthcacheBlockTest::createCustomBlock()
AuthcacheBlockTest::testAdminAccess in modules/authcache_block/authcache_block.test
Ensure that access to authcache configuration on blocks is checked.
AuthcacheBlockTest::testAdminList in modules/authcache_block/authcache_block.test
Ensure that a block shows up in the list of personalized elements.
AuthcacheBlockTest::testFailingMarkupSubstitutionCancelFallback in modules/authcache_block/authcache_block.test
Ensure that markup is substituted for authcache enabled blocks.
AuthcacheBlockTest::testFailingMarkupSubstitutionHideFallback in modules/authcache_block/authcache_block.test
Ensure that markup is substituted for authcache enabled blocks.
AuthcacheBlockTest::testFragemntGet in modules/authcache_block/authcache_block.test
Ensure that a block can be retrieved from the front controller.

... See full list

File

modules/authcache_block/authcache_block.test, line 44
Test cases for the Authcache Block module.

Class

AuthcacheBlockTest
Tests for markup substitution.

Code

protected function createCustomBlock() {

  // Add a new custom block by filling out the input form on the
  // admin/structure/block/add page.
  $custom_block = array();
  $custom_block['info'] = $this
    ->randomName(8);
  $custom_block['title'] = $this
    ->randomName(8);
  $custom_block['body[value]'] = $this
    ->randomName(32);
  $this
    ->drupalPost('admin/structure/block/add', $custom_block, t('Save block'));

  // Confirm that the custom block has been created, and then query the
  // created bid.
  $this
    ->assertText(t('The block has been created.'), 'Custom block successfully created.');
  return db_query("SELECT bid FROM {block_custom} WHERE info = :info", array(
    ':info' => $custom_block['info'],
  ))
    ->fetchField();
}