summaryrefslogtreecommitdiff
path: root/modules/simpletest/tests
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2011-06-11 19:21:17 -0400
committerDries Buytaert <dries@buytaert.net>2011-06-11 19:21:17 -0400
commit7ea8b45ad2cb9677b4ba387677d315389a2b5401 (patch)
tree7f69e591266eb95174477c1be63cb601db189c4b /modules/simpletest/tests
parent966089d5394520c6d02fd077266469b9c7aa45c6 (diff)
downloadbrdo-7ea8b45ad2cb9677b4ba387677d315389a2b5401.tar.gz
brdo-7ea8b45ad2cb9677b4ba387677d315389a2b5401.tar.bz2
- Patch #1089472 by janusman, David_Rothstein: batch API finishes when >99.5% of items have been processed.
Diffstat (limited to 'modules/simpletest/tests')
-rw-r--r--modules/simpletest/tests/batch.test13
1 files changed, 13 insertions, 0 deletions
diff --git a/modules/simpletest/tests/batch.test b/modules/simpletest/tests/batch.test
index d1c0e0b2f..f668e5228 100644
--- a/modules/simpletest/tests/batch.test
+++ b/modules/simpletest/tests/batch.test
@@ -365,6 +365,19 @@ class BatchPercentagesUnitTestCase extends DrupalUnitTestCase {
'99.95' => array('total' => 2000, 'current' => 1999),
// 19999/20000 should add yet another digit and go to 99.995%.
'99.995' => array('total' => 20000, 'current' => 19999),
+ // The next five test cases simulate a batch with a single operation
+ // ('total' equals 1) that takes several steps to complete. Within the
+ // operation, we imagine that there are 501 items to process, and 100 are
+ // completed during each step. The percentages we get back should be
+ // rounded the usual way for the first few passes (i.e., 20%, 40%, etc.),
+ // but for the last pass through, when 500 out of 501 items have been
+ // processed, we do not want to round up to 100%, since that would
+ // erroneously indicate that the processing is complete.
+ '20' => array('total' => 1, 'current' => 100/501),
+ '40' => array('total' => 1, 'current' => 200/501),
+ '60' => array('total' => 1, 'current' => 300/501),
+ '80' => array('total' => 1, 'current' => 400/501),
+ '99.8' => array('total' => 1, 'current' => 500/501),
);
require_once DRUPAL_ROOT . '/includes/batch.inc';
parent::setUp();