You are here

function NodesInBlockTestCase::_setNodesinblockConfiguration in Nodes In Block 7

Helper function to set configuration.

1 call to NodesInBlockTestCase::_setNodesinblockConfiguration()
NodesInBlockTestCase::testNodeSubmissions in ./nodesinblock.test
Test submitting of nodes and see if they appear in blocks and how they are rendered.

File

./nodesinblock.test, line 33
Tests for Nodes in block

Class

NodesInBlockTestCase
@file Tests for Nodes in block

Code

function _setNodesinblockConfiguration() {
  $variables = array(
    'nodesinblock_contenttypes' => 'a:2:{s:4:"page";s:4:"page";s:7:"article";s:7:"article";}',
    'nodesinblock_friendlyname_0' => 's:16:"Nodes in block 1";',
    'nodesinblock_friendlyname_1' => 's:16:"Nodes in block 2";',
    'nodesinblock_friendlyname_2' => 's:16:"Nodes in block 3";',
    'nodesinblock_visibility_0' => 's:1:"1";',
    'nodesinblock_visibility_1' => 's:1:"1";',
    'nodesinblock_visibility_2' => 's:1:"1";',
    'nodesinblock_page_block' => 'a:3:{i:1;i:1;i:2;i:2;i:3;i:0;}',
    'nodesinblock_page_collapsed' => 'i:1;',
    'nodesinblock_page_collapsible' => 'i:1;',
    'nodesinblock_page_label' => 's:14:"Nodes in block";',
    'nodesinblock_page_render' => 's:1:"0";',
    'nodesinblock_article_block' => 'a:3:{i:2;i:2;i:3;i:3;i:1;i:0;}',
    'nodesinblock_article_collapsed' => 'i:1;',
    'nodesinblock_article_collapsible' => 'i:1;',
    'nodesinblock_article_label' => 's:14:"Nodes in block";',
    'nodesinblock_article_render' => 's:1:"0";',
  );
  foreach ($variables as $key => $value) {
    db_query("INSERT INTO {variable} (name, value) VALUES (:key, :value)", array(
      ':key' => $key,
      ':value' => $value,
    ));
  }
  variable_set('nodesinblock_nrofblocks', '3');
  $this
    ->drupalGet('admin/structure/block');
  db_query("UPDATE {block} set status = 1, region = 'sidebar_second' where delta = 0 AND module = 'nodesinblock'");
  db_query("UPDATE {block} set status = 1, region = 'sidebar_second' where delta = 1 AND module = 'nodesinblock'");
  db_query("UPDATE {block} set status = 1, region = 'sidebar_second' where delta = 2 AND module = 'nodesinblock'");
}