diff --git a/core/modules/simpletest/src/AssertContentTrait.php b/core/modules/simpletest/src/AssertContentTrait.php index 8668f2d..a35ae10 100644 --- a/core/modules/simpletest/src/AssertContentTrait.php +++ b/core/modules/simpletest/src/AssertContentTrait.php @@ -1267,8 +1267,8 @@ protected function assertOption($drupal_selector, $option, $message = '', $group * TRUE on pass, FALSE on fail. */ protected function assertOptionWithDrupalSelector($drupal_selector, $option, $message = '', $group = 'Browser') { - $options = $this->xpath('//select[@data-drupal-selector=:data_drupal_selector]//option[@value=:option]', [':data_drupal_selector' => $drupal_selector, ':option' => $option]); - return $this->assertTrue(!empty((string) $options[0]), $message ? $message : SafeMarkup::format('Option @option for field @data_drupal_selector exists.', array('@option' => $option, '@data_drupal_selector' => $drupal_selector)), $group); + $options = $this->xpath('//select[@data-drupal-selector=:data_drupal_selector]//option[@value=:option]', array(':data_drupal_selector' => $drupal_selector, ':option' => $option)); + return $this->assertTrue(isset($options[0]), $message ? $message : SafeMarkup::format('Option @option for field @data_drupal_selector exists.', array('@option' => $option, '@data_drupal_selector' => $drupal_selector)), $group); } /** @@ -1295,7 +1295,7 @@ protected function assertOptionWithDrupalSelector($drupal_selector, $option, $me protected function assertNoOption($drupal_selector, $option, $message = '', $group = 'Browser') { $selects = $this->xpath('//select[@data-drupal-selector=:data_drupal_selector]', [':data_drupal_selector' => $drupal_selector]); $options = $this->xpath('//select[@data-drupal-selector=:data_drupal_selector]//option[@value=:option]', [':data_drupal_selector' => $drupal_selector, ':option' => $option]); - return $this->assertTrue(isset($selects[0]->option) && empty($options[0]), $message ? $message : SafeMarkup::format('Option @option for field @data_drupal_selector exists.', array('@option' => $option, '@data_drupal_selector' => $drupal_selector)), $group); + return $this->assertTrue(isset($selects[0]->option) && empty($options[0]), $message ? $message : SafeMarkup::format('Option @option for field @data_drupal_selector does not exist.', array('@option' => $option, '@data_drupal_selector' => $drupal_selector)), $group); } /** @@ -1375,8 +1375,8 @@ protected function assertOptionSelectedWithDrupalSelector($drupal_selector, $opt * TRUE on pass, FALSE on fail. */ protected function assertNoOptionSelected($drupal_selector, $option, $message = '', $group = 'Browser') { - $elements = $this->xpath('//select[@data-drupal-selector=:data_drupal_selector]//option[@value=:option]', array(':data_drupal_selector' => $drupal_selector, ':option' => $option)); - return $this->assertFalse(isset($elements[0]) && !empty($elements[0]['selected']), $message ? $message : SafeMarkup::format('Option @option for field @data_drupal_selector is selected.', array('@option' => $option, '@data_drupal_selector' => $drupal_selector)), $group); + $elements = $this->xpath('//select[@drupal_selector=:drupal_selector]//option[@value=:option]', array(':drupal_selector' => $drupal_selector, ':option' => $option)); + return $this->assertTrue(isset($elements[0]) && empty($elements[0]['selected']), $message ? $message : SafeMarkup::format('Option @option for field @drupal_selector is not selected.', array('@option' => $option, '@drupal_selector' => $drupal_selector)), $group); } /**