function BlockViewModuleDeltaAlterWebTest::testBlockViewModuleDeltaAlter

Tests that the alter hook is called, even if the delta contains a hyphen.

File

modules/block/block.test, line 776

Class

BlockViewModuleDeltaAlterWebTest
Tests for hook_block_view_MODULE_DELTA_alter().

Code

public function testBlockViewModuleDeltaAlter() {
    $block = new stdClass();
    $block->module = 'block_test';
    $block->delta = 'test_underscore';
    $block->title = '';
    $render_array = _block_render_blocks(array(
        'region' => $block,
    ));
    $render = array_pop($render_array);
    $test_underscore = $render->content['#markup'];
    $this->assertEqual($test_underscore, 'hook_block_view_MODULE_DELTA_alter', 'Found expected altered block content for delta with underscore');
    $block = new stdClass();
    $block->module = 'block_test';
    $block->delta = 'test-hyphen';
    $block->title = '';
    $render_array = _block_render_blocks(array(
        'region' => $block,
    ));
    $render = array_pop($render_array);
    $test_hyphen = $render->content['#markup'];
    $this->assertEqual($test_hyphen, 'hook_block_view_MODULE_DELTA_alter', 'Hyphens (-) in block delta were replaced by underscore (_)');
}

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