You are here

function NodequeueAPISubqueueUnitTest::testNodequeueQueueUp in Nodequeue 6.2

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

File

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

Class

NodequeueAPISubqueueUnitTest

Code

function testNodequeueQueueUp() {

  // 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_up($subqueue, 3);
  $pos = nodequeue_get_subqueue_position($subqueue->sqid, $nids[2]);
  $this
    ->assertEqual($pos, 2, t('Node was moved one position up.'), t('Nodequeue'));
  $rv = nodequeue_queue_up($subqueue, 1);
  $this
    ->assertNull($rv, t('No action if position is 1.'), t('Nodequeue'));
  $rv = nodequeue_queue_up($subqueue, 42);
  $this
    ->assertNull($rv, t('No action if position is out of bounds.'), t('Nodequeue'));
}