You are here

public function NodeImportTestCase::nodeImportDoAllTasks in Node import 6

Finish all pending import tasks.

Parameters

$max_runs: Integer. Maximum number of iterations.

Return value

Number of cron runs needed.

1 call to NodeImportTestCase::nodeImportDoAllTasks()
NodeImportNode::testBasicNode in tests/supported/node.test
Test import of basic node.

File

tests/NodeImportTestCase.php, line 183
DrupalWebTestCase wrapper with some extra functions to ease the development of node_import tests.

Class

NodeImportTestCase
@file DrupalWebTestCase wrapper with some extra functions to ease the development of node_import tests.

Code

public function nodeImportDoAllTasks($max_runs = 100) {
  module_load_include('inc', 'node_import');
  $runs = 0;
  while ($runs <= $max_runs) {
    $runs++;
    node_import_do_all_tasks('ms', '1000');
    $result = db_result(db_query("SELECT count(*) FROM {node_import_tasks} WHERE status <> %d", NODE_IMPORT_STATUS_DONE));
    if ($result > 0) {
      continue;
    }
    break;
  }
  $this
    ->assertTrue($runs <= $max_runs, t('Needed %runs iterations (of %max_runs allowed).', array(
    '%runs' => $runs,
    '%max_runs' => $max_runs,
  )), 'Node import');
  return $runs;
}