You are here

function advancedqueue_test_populate_two_queues in Advanced Queue 7

Create two queues, populate with items, return data array.

Return value

array Data of items entered into queues.

1 call to advancedqueue_test_populate_two_queues()
AdvancedQueueCronTestCase::testCronWorker in tests/advancedqueue.test
Test cron calls workers.

File

tests/advancedqueue_test.inc, line 16
Functions common for Simpletest DrupalWebTestCase.

Code

function advancedqueue_test_populate_two_queues() {

  // Create two queues.
  $queue1 = DrupalQueue::get('advancedqueue_test_1');
  $queue1
    ->createQueue();
  $queue2 = DrupalQueue::get('advancedqueue_test_2');
  $queue2
    ->createQueue();

  // Create four items in queue 1.
  $data = array();
  for ($i = 0; $i < 4; $i++) {
    $data[] = $item = array(
      DrupalTestCase::randomName() => DrupalTestCase::randomName(),
    );
    $queue1
      ->createItem($item);
  }

  // Create four items in queue 2.
  for ($i = 0; $i < 4; $i++) {
    $data[] = $item = array(
      DrupalTestCase::randomName() => DrupalTestCase::randomName(),
    );
    $queue2
      ->createItem($item);
  }
  return $data;
}