function BatchProcessingTestCase::_resultMessages

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

6 calls to BatchProcessingTestCase::_resultMessages()
BatchProcessingTestCase::testBatchForm in modules/simpletest/tests/batch.test
Test batches defined in a form submit handler.
BatchProcessingTestCase::testBatchFormMultipleBatches in modules/simpletest/tests/batch.test
Test batches defined in different submit handlers on the same form.
BatchProcessingTestCase::testBatchFormMultistep in modules/simpletest/tests/batch.test
Test batches defined in a multistep form.
BatchProcessingTestCase::testBatchFormProgrammatic in modules/simpletest/tests/batch.test
Test batches defined in a programmatically submitted form.
BatchProcessingTestCase::testBatchLargePercentage in modules/simpletest/tests/batch.test
Test batches that return $context['finished'] > 1 do in fact complete. See http://drupal.org/node/600836

... See full list

File

modules/simpletest/tests/batch.test, line 238

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.