From 3d4b1549602fb3b2b2a905035939c6d3d9beb1ff Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Sat, 23 Oct 2010 02:26:11 +0000 Subject: #949872 by alex_b, jhodgdon, sun: Fixed filter format assertion randomly failing. --- modules/filter/filter.test | 27 ++++++++++++--------------- modules/simpletest/drupal_web_test_case.php | 2 ++ 2 files changed, 14 insertions(+), 15 deletions(-) (limited to 'modules') diff --git a/modules/filter/filter.test b/modules/filter/filter.test index 33c1b3a74..d9aad514e 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() { @@ -644,18 +653,6 @@ class FilterFormatAccessTestCase extends DrupalWebTestCase { $this->assertNoText($old_title, t('Old title not found.')); } - /** - * 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 ''; - } - /** * Rebuild text format and permission caches in the thread running the tests. */ diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php index e52f0cad9..8b57b174c 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)); -- cgit v1.2.3