You are here

function NodesInBlock::_setNodesinblockConfiguration in Nodes In Block 6

Helper function to set configuration.

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

File

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

Class

NodesInBlock
@file Tests for Nodes in block

Code

function _setNodesinblockConfiguration() {
  $variables = array(
    'nodesinblock_contenttypes' => 'a:2:{s:4:"page";s:4:"page";s:5:"story";s:5:"story";}',
    '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_story_block' => 'a:3:{i:2;i:2;i:3;i:3;i:1;i:0;}',
    'nodesinblock_story_collapsed' => 'i:1;',
    'nodesinblock_story_collapsible' => 'i:1;',
    'nodesinblock_story_label' => 's:14:"Nodes in block";',
    'nodesinblock_story_render' => 's:1:"0";',
  );
  foreach ($variables as $key => $value) {
    db_query("INSERT INTO {variable} (name, value) VALUES ('%s', '%s')", $key, $value);
  }
  variable_set('nodesinblock_nrofblocks', '3');
  $this
    ->drupalGet('admin/build/block');
  db_query("UPDATE {blocks} set status = 1, region = 'right' where delta = 0 AND module = 'nodesinblock'");
  db_query("UPDATE {blocks} set status = 1, region = 'right' where delta = 1 AND module = 'nodesinblock'");
  db_query("UPDATE {blocks} set status = 1, region = 'right' where delta = 2 AND module = 'nodesinblock'");
}