public function BlockViewModuleDeltaAlterWebTest::testBlockViewModuleDeltaAlter

7.x block.test public BlockViewModuleDeltaAlterWebTest::testBlockViewModuleDeltaAlter()

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

File

drupal-7.x/modules/block/block.test, line 775
Tests for block.module.

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 (_)');
}