Exemplo n.º 1
0
 function setUp()
 {
     parent::setUp('api', 'job_queue');
     include drupal_get_path('module', 'api') . '/api.admin.inc';
     include drupal_get_path('module', 'api') . '/parser.inc';
     // Make a branch for sample code.
     $branch->branch_name = '6';
     $branch->title = 'Testing 6';
     $branch->directory = drupal_get_path('module', 'api') . '/tests/sample';
     $branch = null;
     api_save_branch($branch);
     // Parse the code.
     api_update_all_branches();
     while (job_queue_dequeue()) {
     }
 }
Exemplo n.º 2
0
 /**
  * Overrides ApiTestCase::setUp().
  *
  * Sets up the sample branch, using the administrative interface, and updates
  * this and the default PHP branch.
  */
 public function setUp()
 {
     $this->baseSetUp();
     // Create a "file" branch with the sample code, from the admin interface.
     $this->branch_info = $this->setUpBranchUI();
     // Create a "php" branch with the sample PHP function list, from the admin
     // interface.
     $this->php_branch_info = $this->createPHPBranchUI();
     // Parse the code.
     $this->resetBranchesAndCache();
     api_update_all_branches();
     $this->processApiParseQueue();
 }
Exemplo n.º 3
0
 /**
  * Updates branches and runs all update branch jobs.
  */
 function updateBranches()
 {
     api_update_all_branches();
     $queues = api_cron_queue_info();
     drupal_alter('cron_queue_info', $queues);
     $queue_name = 'api_branch_update';
     $info = $queues[$queue_name];
     $function = $info['worker callback'];
     $queue = DrupalQueue::get($queue_name);
     $count = 0;
     while ($item = $queue->claimItem()) {
         $function($item->data);
         $queue->deleteItem($item);
     }
     $this->resetBranchesAndCache();
 }