function BlockHashTestCase::doRehash

Performs a block rehash and checks several related assertions.

Parameters

$alter_active: Set to TRUE if the block_test module's hook_block_info_alter() implementation is expected to make a change that results in an existing block needing to be resaved to the database. Defaults to FALSE.

1 call to BlockHashTestCase::doRehash()
BlockHashTestCase::testBlockRehash in modules/block/block.test
Tests that block rehashing does not write to the database too often.

File

modules/block/block.test, line 953

Class

BlockHashTestCase
Tests that block rehashing works correctly.

Code

function doRehash($alter_active = FALSE) {
    $saves = 0;
    foreach (_block_rehash() as $block) {
        $module = $block['module'];
        $delta = $block['delta'];
        if ($alter_active && $module == 'block_test' && $delta == 'test_html_id') {
            $this->assertFalse(empty($block['saved']), "{$module} {$delta} saved");
            $saves++;
        }
        else {
            $this->assertTrue(empty($block['saved']), "{$module} {$delta} not saved");
        }
    }
    $this->assertEqual($alter_active, $saves);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.