public function ProcessingTest::_resultMessages in Drupal 10
Same name and namespace in other branches
- 8 core/modules/system/tests/src/Functional/Batch/ProcessingTest.php \Drupal\Tests\system\Functional\Batch\ProcessingTest::_resultMessages()
- 9 core/modules/system/tests/src/Functional/Batch/ProcessingTest.php \Drupal\Tests\system\Functional\Batch\ProcessingTest::_resultMessages()
Returns expected result messages for the test batches.
7 calls to ProcessingTest::_resultMessages()
- ProcessingTest::testBatchForm in core/
modules/ system/ tests/ src/ Functional/ Batch/ ProcessingTest.php - Tests batches defined in a form submit handler.
- ProcessingTest::testBatchFormMultipleBatches in core/
modules/ system/ tests/ src/ Functional/ Batch/ ProcessingTest.php - Tests batches defined in different submit handlers on the same form.
- ProcessingTest::testBatchFormMultistep in core/
modules/ system/ tests/ src/ Functional/ Batch/ ProcessingTest.php - Tests batches defined in a multistep form.
- ProcessingTest::testBatchFormProgrammatic in core/
modules/ system/ tests/ src/ Functional/ Batch/ ProcessingTest.php - Tests batches defined in a programmatically submitted form.
- ProcessingTest::testBatchLargePercentage in core/
modules/ system/ tests/ src/ Functional/ Batch/ ProcessingTest.php - Tests batches that return $context['finished'] > 1 do in fact complete.
File
- core/
modules/ system/ tests/ src/ Functional/ Batch/ ProcessingTest.php, line 322
Class
- ProcessingTest
- Tests batch processing in form and non-form workflow.
Namespace
Drupal\Tests\system\Functional\BatchCode
public function _resultMessages($id) {
$messages = [];
// The elapsed time should be either in minutes and seconds or only seconds.
$pattern_elapsed = ' \\((\\d+ mins? )?\\d+ secs?\\)';
switch ($id) {
case 'batch_0':
$messages[] = 'results for batch 0' . $pattern_elapsed . '<div class="item-list"><ul><li>none</li></ul></div>';
break;
case 'batch_1':
$messages[] = 'results for batch 1' . $pattern_elapsed . '<div class="item-list"><ul><li>op 1: processed 10 elements</li></ul></div>';
break;
case 'batch_2':
$messages[] = 'results for batch 2' . $pattern_elapsed . '<div class="item-list"><ul><li>op 2: processed 10 elements</li></ul></div>';
break;
case 'batch_3':
$messages[] = 'results for batch 3' . $pattern_elapsed . '<div class="item-list"><ul><li>op 1: processed 10 elements</li><li>op 2: processed 10 elements</li></ul></div>';
break;
case 'batch_4':
$messages[] = 'results for batch 4' . $pattern_elapsed . '<div class="item-list"><ul><li>op 1: processed 10 elements</li></ul></div>';
$messages = array_merge($messages, $this
->_resultMessages('batch_2'));
break;
case 'batch_5':
$messages[] = 'results for batch 5' . $pattern_elapsed . '<div class="item-list"><ul><li>op 5: processed 10 elements</li></ul></div>';
break;
case 'batch_6':
$messages[] = 'results for batch 6' . $pattern_elapsed . '<div class="item-list"><ul><li>op 6: processed 10 elements</li></ul></div>';
break;
case 'batch_7':
$messages[] = 'results for batch 7' . $pattern_elapsed . '<div class="item-list"><ul><li>op 7: processed 10 elements</li></ul></div>';
$messages = array_merge($messages, $this
->_resultMessages('batch_6'));
$messages = array_merge($messages, $this
->_resultMessages('batch_5'));
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;
}