diff options
Diffstat (limited to 'modules/simpletest/tests/common.test')
-rw-r--r-- | modules/simpletest/tests/common.test | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/modules/simpletest/tests/common.test b/modules/simpletest/tests/common.test index a6f1053e6..9d8c1d23f 100644 --- a/modules/simpletest/tests/common.test +++ b/modules/simpletest/tests/common.test @@ -535,8 +535,29 @@ class DrupalRenderUnitTestCase extends DrupalWebTestCase { ), ); $output = drupal_render($elements); + // The lowest weight element should appear last in $output. - $this->assertTrue(strpos($output, $second) > strpos($output, $first), t('Elements were sorted correctly by weight')); + $this->assertTrue(strpos($output, $second) > strpos($output, $first), t('Elements were sorted correctly by weight.')); + + // Confirm that the $elements array has '#sorted' set to TRUE. + $this->assertTrue($elements['#sorted'], t("'#sorted' => TRUE was added to the array")); + + // Now the same array structure, but with #sorted set to TRUE. + $elements = array( + 'second' => array( + '#weight' => 10, + '#markup' => $second, + ), + 'first' => array( + '#weight' => 0, + '#markup' => $first, + ), + '#sorted' => TRUE, + ); + $output = drupal_render($elements); + + // The elements should appear in output in the same order as the array. + $this->assertTrue(strpos($output, $second) < strpos($output, $first), t('Elements were not sorted.')); } } |