You are here

function NodequeueManipulateTestCase::testNodequeueAddNode in Nodequeue 7.2

Same name and namespace in other branches
  1. 6.2 tests/nodequeue.test \NodequeueManipulateTestCase::testNodequeueAddNode()

File

tests/nodequeue.test, line 162
Tests for the Nodequeue module.

Class

NodequeueManipulateTestCase

Code

function testNodequeueAddNode() {

  // create and populate a nodequeue
  $queue = $this
    ->createNodequeue(array(
    'page',
    'article',
  ), array(
    2,
  ), 6);
  $nodes = $this
    ->populateNodequeue($queue->qid, 4);

  // create a new node and add it to the queue using the 'add to queue' link
  // in the table on the nodequeue tab.
  $node = $this
    ->drupalCreateNode(array(
    'type' => 'article',
  ));
  $this
    ->drupalGet('node/' . $node->nid . '/nodequeue');
  $this
    ->assertText('Add to queue', t('"Add to queue" link is present.'), t('Nodequeue'));
  $this
    ->clickLink('Add to queue');
  $this
    ->assertRaw('"nodequeue-in-queue">' . (count($nodes) + 1), t('Nodequeue table reports correct number of elements in queue.'), t('Nodequeue'));
  $this
    ->assertText('Remove from queue', t('"Remove from queue" link is present.'), t('Nodequeue'));

  // fill up the queue
  $node = $this
    ->drupalCreateNode(array(
    'type' => 'article',
  ));
  $this
    ->drupalGet('node/' . $node->nid . '/nodequeue');
  $this
    ->assertText('Add to queue', t('"Add to queue" link is present.'), t('Nodequeue'));
  $this
    ->clickLink('Add to queue');
  $this
    ->assertRaw('"nodequeue-in-queue">Queue full', t('Nodequeue table reports the queue as full.'), t('Nodequeue'));
}