diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-10-23 02:26:11 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-10-23 02:26:11 +0000 |
commit | 3d4b1549602fb3b2b2a905035939c6d3d9beb1ff (patch) | |
tree | f6553ee3c4942cbf63d41aacc3d39700267e4946 | |
parent | 7f9a866cf19f5dc927031b91afb72c671575f8f7 (diff) | |
download | drupal-3d4b1549602fb3b2b2a905035939c6d3d9beb1ff.tar.gz drupal-3d4b1549602fb3b2b2a905035939c6d3d9beb1ff.zip |
#949872 by alex_b, jhodgdon, sun: Fixed filter format assertion randomly failing.
-rw-r--r-- | modules/filter/filter.test | 27 | ||||
-rw-r--r-- | modules/simpletest/drupal_web_test_case.php | 2 |
2 files changed, 14 insertions, 15 deletions
diff --git a/modules/filter/filter.test b/modules/filter/filter.test index 33c1b3a7413..d9aad514ef9 100644 --- a/modules/filter/filter.test +++ b/modules/filter/filter.test @@ -497,9 +497,18 @@ class FilterFormatAccessTestCase extends DrupalWebTestCase { // the disallowed format does not. $this->drupalLogin($this->web_user); $this->drupalGet('node/add/page'); - $this->assertRaw($this->formatSelectorHTML($this->allowed_format), t('The allowed text format appears as an option when adding a new node.')); - $this->assertNoRaw($this->formatSelectorHTML($this->disallowed_format), t('The disallowed text format does not appear as an option when adding a new node.')); - $this->assertRaw($this->formatSelectorHTML(filter_format_load(filter_fallback_format())), t('The fallback format appears as an option when adding a new node.')); + $langcode = LANGUAGE_NONE; + $elements = $this->xpath('//select[@name=:name]/option', array( + ':name' => "body[$langcode][0][format]", + ':option' => $this->allowed_format->format, + )); + $options = array(); + foreach ($elements as $element) { + $options[(string) $element['value']] = $element; + } + $this->assertTrue(isset($options[$this->allowed_format->format]), t('The allowed text format appears as an option when adding a new node.')); + $this->assertFalse(isset($options[$this->disallowed_format->format]), t('The disallowed text format does not appear as an option when adding a new node.')); + $this->assertTrue(isset($options[filter_fallback_format()]), t('The fallback format appears as an option when adding a new node.')); } function testFormatRoles() { @@ -645,18 +654,6 @@ class FilterFormatAccessTestCase extends DrupalWebTestCase { } /** - * Returns the expected HTML for a particular text format selector. - * - * @param $format - * An object representing the text format for which to return HTML. - * @return - * The expected HTML for that text format's selector. - */ - function formatSelectorHTML($format) { - return '<option value="' . $format->format . '">' . $format->name . '</option>'; - } - - /** * Rebuild text format and permission caches in the thread running the tests. */ protected function resetFilterCaches() { diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php index e52f0cad9c1..8b57b174cfc 100644 --- a/modules/simpletest/drupal_web_test_case.php +++ b/modules/simpletest/drupal_web_test_case.php @@ -3020,6 +3020,8 @@ class DrupalWebTestCase extends DrupalTestCase { * Message to display. * @return * TRUE on pass, FALSE on fail. + * + * @todo $id is unusable. Replace with $name. */ protected function assertOptionSelected($id, $option, $message = '') { $elements = $this->xpath('//select[@id=:id]//option[@value=:option]', array(':id' => $id, ':option' => $option)); |