You are here

function NodesInBlockTestCase::_createNode in Nodes In Block 7

Helper function to create a node with standard settings.

1 call to NodesInBlockTestCase::_createNode()
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 67
Tests for Nodes in block

Class

NodesInBlockTestCase
@file Tests for Nodes in block

Code

function _createNode($type, $nid = 1, $region = 0, $vis = '*', $nib = TRUE) {
  $edit = array(
    'title' => 'Title ' . $nid,
    'body[und][0][value]' => 'Text ' . $nid,
  );
  if ($nib) {
    $edit['nodesinblock_delta'] = $region;
    $edit['nodesinblock_visibility'] = $vis;
    $edit['nodesinblock_render'] = 'full:1';
  }
  $this
    ->drupalPost('node/add/' . $type, $edit, t('Save'));
  if ($nib) {
    $result = db_query("SELECT nid FROM {nodesinblock} WHERE nid = :nid", array(
      ':nid' => $nid,
    ))
      ->fetchField();
    $this
      ->assertTrue($result, 'Node ' . $nid . ' saved in nodesinblock table', 'Node submission');
  }
}