You are here

function NodequeueAPISubqueueUnitTest::testNodequeueQueueDown in Nodequeue 6.2

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

File

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

Class

NodequeueAPISubqueueUnitTest

Code

function testNodequeueQueueDown() {

  // 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_down($subqueue, 2);
  $pos = nodequeue_get_subqueue_position($subqueue->sqid, $nids[1]);
  $this
    ->assertEqual($pos, 3, t('Node was moved one position down.'), 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'));
}