You are here

private function PatternsBlockTestCase::testModify in Patterns 7

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

File

tests/block/block.test, line 105
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);

  // Expected messages.
  // TODO: 2 times each.
  $this
    ->assertText(t('The block settings have been updated.'));
  $this
    ->assertText(t('The block configuration has been saved.'));

  // The user block should be set up.
  // TODO
  // 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, '0');
  $this
    ->assertEqual($block[0]->pages, "page2\r\npage3\r\npage4");
  $this
    ->assertIdentical($block[0]->body, 'Here comes the body text.2');
  $this
    ->assertIdentical($block[0]->info, 'Test custom block2');
  $this
    ->assertIdentical($block[0]->format, 'plain_text');
  $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, '0');
  $this
    ->assertIdentical($block[0]->weight, '4');
  $this
    ->assertIdentical($block[0]->region, '-1');
  $this
    ->assertIdentical($block[0]->custom, '1');
  $this
    ->assertIdentical($block[0]->visibility, '0');
  $this
    ->assertEqual($block[0]->pages, "page2\r\npage3\r\npage4");

  //debug($block);
  $block = db_select('block', 'b')
    ->fields('b')
    ->execute()
    ->fetchAll();

  //debug($block);
  $this
    ->drupalGet('admin/structure/block');
  $this
    ->drupalGet('admin/structure/block/manage/block/1/configure');
}