You are here

function NodequeueAPISubqueueUnitTest::testNodequeueQueueBack in Nodequeue 6.2

Same name and namespace in other branches
  1. 7.2 tests/nodequeue.test \NodequeueAPISubqueueUnitTest::testNodequeueQueueBack()

File

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

Class

NodequeueAPISubqueueUnitTest

Code

function testNodequeueQueueBack() {

  // create and populate a nodequeue
  $queue = $this
    ->createNodequeue(array(
    'page',
    'story',
  ), array(
    2,
  ), 4);
  $nodes = $this
    ->populateNodequeue($queue->qid, 4);
  $nids = array_keys($nodes);
  $subqueues = nodequeue_load_subqueues_by_queue($queue->qid);
  $subqueue = array_shift($subqueues);
  nodequeue_queue_back($subqueue, 2);
  $pos = nodequeue_get_subqueue_position($subqueue->sqid, $nids[1]);
  $this
    ->assertEqual($pos, 4, t('Node was moved to the back of the queue.'), t('Nodequeue'));
  $rv = nodequeue_queue_down($subqueue, 0);
  $this
    ->assertNull($rv, t('No action if position is out of bounds.'), t('Nodequeue'));
  $rv = nodequeue_queue_down($subqueue, 42);
  $this
    ->assertNull($rv, t('No action if position is out of bounds.'), t('Nodequeue'));
}