You are here

private function PatternsBlockTestCase::testModify in Patterns 7.2

Same name and namespace in other branches
  1. 7 tests/block/block.test \PatternsBlockTestCase::testModify()
1 call to PatternsBlockTestCase::testModify()
PatternsBlockTestCase::testCreateModifyDelete in tests/block/block.test

File

tests/block/block.test, line 107
SimpleTests for the Block component of Patterns.

Class

PatternsBlockTestCase
@file SimpleTests for the Block component of Patterns.

Code

private function testModify() {

  // Run the pattern.
  parent::runFile('block_modify.yaml', 'Blocks (modify)', $this->block_tests_dir);

  //IMPORTANT: the delta values might need to be changed in both (pattern and test) if there

  //were already some custom blocks. We keep 1 since is the default value for a clean installation

  // The custom block should exist with the right values for the bartik and seven themes.
  $block = db_select('block', 'b')
    ->fields('b')
    ->condition('module', 'block')
    ->condition('theme', 'bartik')
    ->condition('delta', '1');
  $block
    ->join('block_custom', 'bc', 'b.delta = bc.bid');
  $block = $block
    ->fields('bc')
    ->execute()
    ->fetchAll();
  $this
    ->assertIdentical(count($block), 1);
  $this
    ->assertIdentical($block[0]->status, '1');
  $this
    ->assertIdentical($block[0]->title, 'Test title2');
  $this
    ->assertIdentical($block[0]->weight, '4');
  $this
    ->assertIdentical($block[0]->region, 'header');
  $this
    ->assertIdentical($block[0]->custom, '1');
  $this
    ->assertIdentical($block[0]->visibility, '1');
  $this
    ->assertEqual($block[0]->pages, "<front>");
  $block = db_select('block', 'b')
    ->fields('b')
    ->condition('module', 'block')
    ->condition('theme', 'seven')
    ->condition('delta', '1');
  $block
    ->join('block_custom', 'bc', 'b.delta = bc.bid');
  $block = $block
    ->fields('bc')
    ->execute()
    ->fetchAll();
  $this
    ->assertIdentical(count($block), 1);
  $this
    ->assertIdentical($block[0]->status, '1');
  $this
    ->assertIdentical($block[0]->weight, '4');
  $this
    ->assertIdentical($block[0]->region, 'content');
  $this
    ->assertIdentical($block[0]->custom, '1');
  $this
    ->assertIdentical($block[0]->visibility, '1');
  $this
    ->assertEqual($block[0]->pages, "<front>");
  $block = db_select('block', 'b')
    ->fields('b')
    ->execute()
    ->fetchAll();
  $this
    ->drupalGet('admin/structure/block');
  $this
    ->drupalGet('admin/structure/block/manage/block/1/configure');
}