You are here

function NodeQueueTest::test_add_node_to_queue in Nodequeue 5.2

This test verifies that we can go to the node/nid/nodequeue page of a node, and add that node to the nodequeue 1.

After the node is added to the queue, we go to the same page and remove it.

File

tests/nodequeue.test, line 26

Class

NodeQueueTest
This class is used to test the randomchoice module with simpletest.

Code

function test_add_node_to_queue() {
  $nid_array = $this
    ->nodequeue_get_nids(1);
  $new_nid = 7;
  while (FALSE !== array_search($new_nid, $nid_array)) {
    $new_nid++;
  }
  $this
    ->login_nodequeue_user();
  $html = $this
    ->drupalGet('http://localhost' . url('node/' . $new_nid . '/nodequeue'));
  $return = $this
    ->clickLink('Add to queue');
  $new_nid_array = $this
    ->nodequeue_get_nids(1);
  $this
    ->assertEqual(count($nid_array) + 1, count($new_nid_array), '[nodequeue] Adding a new node to the queue increases the count: %s');
  $html = $this
    ->drupalGet('http://localhost' . url('node/' . $new_nid . '/nodequeue', 'destination=node/7/nodequeue'));

  // refresh!
  $return = $this
    ->clickLink('Remove from queue');
  $new_nid_array = $this
    ->nodequeue_get_nids(1);
  $this
    ->assertEqual(count($nid_array), count($new_nid_array), '[nodequeue] Removing the new node from the queue returns the count to the original: %s');
}