You are here

public function SmartqueueDomainTestCase::smartqueueDomainGetSqids in Smartqueue Domain 7

Helper function. Queries the database for all subqueues based on given smartqueue id ($qid).

Parameters

$qid: The id of the smartqueue.

Return value

An array of subqueue ids, keyed by domain id.

1 call to SmartqueueDomainTestCase::smartqueueDomainGetSqids()
SmartqueueDomainAdminTest::testCreateSubqueues in tests/smartqueue_domain.test
Tests creation and deleted of subqueues.

File

tests/smartqueue_domain.test, line 50
Simpletest for Smartqueue domain module.

Class

SmartqueueDomainTestCase
@file Simpletest for Smartqueue domain module.

Code

public function smartqueueDomainGetSqids($qid) {
  $sqids = array();
  if ($qid) {

    // Query database for all existing subqueues attached to this smartqueue.
    $result = db_query("SELECT sqid, reference FROM {nodequeue_subqueue} WHERE qid = " . $qid);
    foreach ($result as $record) {
      $parts = explode(':', $record->reference);
      $sqids[$parts[3]] = $record->sqid;
    }
  }
  else {

    // There was a problem with our smartqueue id.
    $this
      ->fail(format_string('$qid is NULL or empty.'));
  }
  return $sqids;
}