1 batch.test BatchProcessingTestCase::_resultMessages($id)

Helper function: return expected result messages for the test batches.

File

core/modules/simpletest/tests/batch.test, line 234
Tests for the Batch API.

Class

BatchProcessingTestCase
Tests for the Batch API.

Code

function _resultMessages($id) {
  $messages = array();

  switch ($id) {
    case 'batch_0':
      $messages[] = 'results for batch 0<br />none';
      break;

    case 'batch_1':
      $messages[] = 'results for batch 1<br />op 1: processed 10 elements';
      break;

    case 'batch_2':
      $messages[] = 'results for batch 2<br />op 2: processed 10 elements';
      break;

    case 'batch_3':
      $messages[] = 'results for batch 3<br />op 1: processed 10 elements<br />op 2: processed 10 elements';
      break;

    case 'batch_4':
      $messages[] = 'results for batch 4<br />op 1: processed 10 elements';
      $messages = array_merge($messages, $this->_resultMessages('batch_2'));
      break;

    case 'batch_5':
      $messages[] = 'results for batch 5<br />op 1: processed 10 elements. $context[\'finished\'] > 1 returned from batch process, with success.';
      break;

    case 'chained':
      $messages = array_merge($messages, $this->_resultMessages('batch_1'));
      $messages = array_merge($messages, $this->_resultMessages('batch_2'));
      $messages = array_merge($messages, $this->_resultMessages('batch_3'));
      break;
  }
  return $messages;
}