Skip to content

Commit

Permalink
Refactor tests: make block-test readable by moving out block-setting
Browse files Browse the repository at this point in the history
  • Loading branch information
Bèr Kessels committed May 5, 2013
1 parent 218d5cf commit f018374
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions tests/tagadelic_taxonomy.test
Original file line number Diff line number Diff line change
Expand Up @@ -134,29 +134,13 @@ class TagadelicTaxonomyTestCase extends DrupalWebTestCase {
}

public function testBlockRendering() {
theme_enable(array('seven'));
$region = 'content';
$module = 'tagadelic_taxonomy';

$this->enableBlock();
$this->createNodesWithTags(10);

// set the block to a theme region, taken from block.test
$delta = db_query("SELECT delta FROM {block} WHERE module = :module AND theme = :theme", array(':module' => $module, ':theme' => 'seven'))->fetchField();
$edit = array();
$edit['blocks[' . $module . '_' . $delta . '][region]'] = $region;

$this->drupalLogin($this->admin_user);
$this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
$this->drupalLogout();

// get the home and look for the block title
$this->drupalGet('node');
$this->assertText(t("Tag Cloud"), "Title of block is Tag Cloud");
}

public function testBlockHasMaxsixtyTags() {
}

/*************************************************************************
* Test Helpers
*************************************************************************/
Expand Down Expand Up @@ -233,6 +217,19 @@ class TagadelicTaxonomyTestCase extends DrupalWebTestCase {
return $this;
}

private function enableBlock() {
theme_enable(array('seven'));
$region = 'content';
$module = 'tagadelic_taxonomy';
// set the block to a theme region, taken from block.test
$delta = db_query("SELECT delta FROM {block} WHERE module = :module AND theme = :theme", array(':module' => $module, ':theme' => 'seven'))->fetchField();
$edit = array();
$edit['blocks[' . $module . '_' . $delta . '][region]'] = $region;

$this->drupalLogin($this->admin_user);
$this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
$this->drupalLogout();
}

/**
* assertHasXpath Asserts the existence of an xpath
Expand Down

0 comments on commit f018374

Please sign in to comment.