diff options
Diffstat (limited to 'modules/simpletest/tests/batch.test')
-rw-r--r-- | modules/simpletest/tests/batch.test | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/modules/simpletest/tests/batch.test b/modules/simpletest/tests/batch.test index 451575cf2..f14f56ba9 100644 --- a/modules/simpletest/tests/batch.test +++ b/modules/simpletest/tests/batch.test @@ -28,9 +28,9 @@ class BatchProcessingTestCase extends DrupalWebTestCase { function testBatchNoForm() { // Displaying the page triggers batch 1. $this->drupalGet('batch_test/no_form'); - $this->assertBatchMessages($this->_resultMessages(1), t('Batch for step 2 performed successfully.')); - $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_1'), t('Execution order was correct.')); - $this->assertText('Redirection successful.', t('Redirection after batch execution is correct.')); + $this->assertBatchMessages($this->_resultMessages(1), 'Batch for step 2 performed successfully.'); + $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_1'), 'Execution order was correct.'); + $this->assertText('Redirection successful.', 'Redirection after batch execution is correct.'); } /** @@ -40,36 +40,36 @@ class BatchProcessingTestCase extends DrupalWebTestCase { // Batch 0: no operation. $edit = array('batch' => 'batch_0'); $this->drupalPost('batch_test/simple', $edit, 'Submit'); - $this->assertBatchMessages($this->_resultMessages('batch_0'), t('Batch with no operation performed successfully.')); - $this->assertText('Redirection successful.', t('Redirection after batch execution is correct.')); + $this->assertBatchMessages($this->_resultMessages('batch_0'), 'Batch with no operation performed successfully.'); + $this->assertText('Redirection successful.', 'Redirection after batch execution is correct.'); // Batch 1: several simple operations. $edit = array('batch' => 'batch_1'); $this->drupalPost('batch_test/simple', $edit, 'Submit'); - $this->assertBatchMessages($this->_resultMessages('batch_1'), t('Batch with simple operations performed successfully.')); - $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_1'), t('Execution order was correct.')); - $this->assertText('Redirection successful.', t('Redirection after batch execution is correct.')); + $this->assertBatchMessages($this->_resultMessages('batch_1'), 'Batch with simple operations performed successfully.'); + $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_1'), 'Execution order was correct.'); + $this->assertText('Redirection successful.', 'Redirection after batch execution is correct.'); // Batch 2: one multistep operation. $edit = array('batch' => 'batch_2'); $this->drupalPost('batch_test/simple', $edit, 'Submit'); - $this->assertBatchMessages($this->_resultMessages('batch_2'), t('Batch with multistep operation performed successfully.')); - $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_2'), t('Execution order was correct.')); - $this->assertText('Redirection successful.', t('Redirection after batch execution is correct.')); + $this->assertBatchMessages($this->_resultMessages('batch_2'), 'Batch with multistep operation performed successfully.'); + $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_2'), 'Execution order was correct.'); + $this->assertText('Redirection successful.', 'Redirection after batch execution is correct.'); // Batch 3: simple + multistep combined. $edit = array('batch' => 'batch_3'); $this->drupalPost('batch_test/simple', $edit, 'Submit'); - $this->assertBatchMessages($this->_resultMessages('batch_3'), t('Batch with simple and multistep operations performed successfully.')); - $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_3'), t('Execution order was correct.')); - $this->assertText('Redirection successful.', t('Redirection after batch execution is correct.')); + $this->assertBatchMessages($this->_resultMessages('batch_3'), 'Batch with simple and multistep operations performed successfully.'); + $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_3'), 'Execution order was correct.'); + $this->assertText('Redirection successful.', 'Redirection after batch execution is correct.'); // Batch 4: nested batch. $edit = array('batch' => 'batch_4'); $this->drupalPost('batch_test/simple', $edit, 'Submit'); - $this->assertBatchMessages($this->_resultMessages('batch_4'), t('Nested batch performed successfully.')); - $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_4'), t('Execution order was correct.')); - $this->assertText('Redirection successful.', t('Redirection after batch execution is correct.')); + $this->assertBatchMessages($this->_resultMessages('batch_4'), 'Nested batch performed successfully.'); + $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_4'), 'Execution order was correct.'); + $this->assertText('Redirection successful.', 'Redirection after batch execution is correct.'); } /** @@ -77,19 +77,19 @@ class BatchProcessingTestCase extends DrupalWebTestCase { */ function testBatchFormMultistep() { $this->drupalGet('batch_test/multistep'); - $this->assertText('step 1', t('Form is displayed in step 1.')); + $this->assertText('step 1', 'Form is displayed in step 1.'); // First step triggers batch 1. $this->drupalPost(NULL, array(), 'Submit'); - $this->assertBatchMessages($this->_resultMessages('batch_1'), t('Batch for step 1 performed successfully.')); - $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_1'), t('Execution order was correct.')); - $this->assertText('step 2', t('Form is displayed in step 2.')); + $this->assertBatchMessages($this->_resultMessages('batch_1'), 'Batch for step 1 performed successfully.'); + $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_1'), 'Execution order was correct.'); + $this->assertText('step 2', 'Form is displayed in step 2.'); // Second step triggers batch 2. $this->drupalPost(NULL, array(), 'Submit'); - $this->assertBatchMessages($this->_resultMessages('batch_2'), t('Batch for step 2 performed successfully.')); - $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_2'), t('Execution order was correct.')); - $this->assertText('Redirection successful.', t('Redirection after batch execution is correct.')); + $this->assertBatchMessages($this->_resultMessages('batch_2'), 'Batch for step 2 performed successfully.'); + $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_2'), 'Execution order was correct.'); + $this->assertText('Redirection successful.', 'Redirection after batch execution is correct.'); } /** @@ -102,11 +102,11 @@ class BatchProcessingTestCase extends DrupalWebTestCase { $edit = array('value' => $value); $this->drupalPost('batch_test/chained', $edit, 'Submit'); // Check that result messages are present and in the correct order. - $this->assertBatchMessages($this->_resultMessages('chained'), t('Batches defined in separate submit handlers performed successfully.')); + $this->assertBatchMessages($this->_resultMessages('chained'), 'Batches defined in separate submit handlers performed successfully.'); // The stack contains execution order of batch callbacks and submit // hanlders and logging of corresponding $form_state[{values']. - $this->assertEqual(batch_test_stack(), $this->_resultStack('chained', $value), t('Execution order was correct, and $form_state is correctly persisted.')); - $this->assertText('Redirection successful.', t('Redirection after batch execution is correct.')); + $this->assertEqual(batch_test_stack(), $this->_resultStack('chained', $value), 'Execution order was correct, and $form_state is correctly persisted.'); + $this->assertText('Redirection successful.', 'Redirection after batch execution is correct.'); } /** @@ -120,11 +120,11 @@ class BatchProcessingTestCase extends DrupalWebTestCase { $value = rand(0, 255); $this->drupalGet('batch_test/programmatic/' . $value); // Check that result messages are present and in the correct order. - $this->assertBatchMessages($this->_resultMessages('chained'), t('Batches defined in separate submit handlers performed successfully.')); + $this->assertBatchMessages($this->_resultMessages('chained'), 'Batches defined in separate submit handlers performed successfully.'); // The stack contains execution order of batch callbacks and submit // hanlders and logging of corresponding $form_state[{values']. - $this->assertEqual(batch_test_stack(), $this->_resultStack('chained', $value), t('Execution order was correct, and $form_state is correctly persisted.')); - $this->assertText('Got out of a programmatic batched form.', t('Page execution continues normally.')); + $this->assertEqual(batch_test_stack(), $this->_resultStack('chained', $value), 'Execution order was correct, and $form_state is correctly persisted.'); + $this->assertText('Got out of a programmatic batched form.', 'Page execution continues normally.'); } /** @@ -135,7 +135,7 @@ class BatchProcessingTestCase extends DrupalWebTestCase { // form. $value = rand(0, 255); $this->drupalGet('batch_test/nested_programmatic/' . $value); - $this->assertEqual(batch_test_stack(), array('mock form submitted with value = ' . $value), t('drupal_form_submit() ran successfully within a batch operation.')); + $this->assertEqual(batch_test_stack(), array('mock form submitted with value = ' . $value), 'drupal_form_submit() ran successfully within a batch operation.'); } /** @@ -149,7 +149,7 @@ class BatchProcessingTestCase extends DrupalWebTestCase { * TRUE on pass, FALSE on fail. */ function assertBatchMessages($texts, $message) { - $pattern = '|' . implode('.*', $texts) .'|s'; + $pattern = '|' . implode('.*', $texts) . '|s'; return $this->assertPattern($pattern, $message); } @@ -282,7 +282,7 @@ class BatchPageTestCase extends DrupalWebTestCase { // administrative page. $this->drupalGet('admin/batch_test/test_theme'); // The stack should contain the name of the the used on the progress page. - $this->assertEqual(batch_test_stack(), array('seven'), t('A progressive batch correctly uses the theme of the page that started the batch.')); + $this->assertEqual(batch_test_stack(), array('seven'), 'A progressive batch correctly uses the theme of the page that started the batch.'); } } @@ -357,10 +357,10 @@ class BatchPercentagesUnitTestCase extends DrupalUnitTestCase { $current = $arguments['current']; $actual_result = _batch_api_percentage($total, $current); if ($actual_result === $expected_result) { - $this->pass(t('Expected the batch api percentage at the state @numerator/@denominator to be @expected%, and got @actual%.', array('@numerator' => $current, '@denominator' => $total, '@expected' => $expected_result, '@actual' => $actual_result))); + $this->pass('Expected the batch api percentage at the state ' . $current . '/' . $total . ' to be ' . $expected_result . '%, and got ' . $actual_result . '%.'); } else { - $this->fail(t('Expected the batch api percentage at the state @numerator/@denominator to be @expected%, but got @actual%.', array('@numerator' => $current, '@denominator' => $total, '@expected' => $expected_result, '@actual' => $actual_result))); + $this->fail('Expected the batch api percentage at the state ' . $current . '/' . $total . ' to be ' . $expected_result . '%, but got ' . $actual_result . '%.'); } } } |