protected function DrupalWebTestCase::assertNoOptionSelected

Asserts that a select option in the current page is not checked.

Parameters

$id: ID of select field to assert.

$option: Option to assert.

$message: (optional) Message to display.

Return value

TRUE on pass, FALSE on fail.

2 calls to DrupalWebTestCase::assertNoOptionSelected()
OptionsWidgetsTestCase::testSelectListMultiple in drupal/modules/field/modules/options/options.test
Tests the 'options_select' widget (multiple select).
OptionsWidgetsTestCase::testSelectListSingle in drupal/modules/field/modules/options/options.test
Tests the 'options_select' widget (single select).

File

drupal/modules/simpletest/drupal_web_test_case.php, line 3559

Class

DrupalWebTestCase
Test case for typical Drupal tests.

Code

protected function assertNoOptionSelected($id, $option, $message = '') {
  $elements = $this
    ->xpath('//select[@id=:id]//option[@value=:option]', array(
    ':id' => $id,
    ':option' => $option,
  ));
  return $this
    ->assertTrue(isset($elements[0]) && empty($elements[0]['selected']), $message ? $message : t('Option @option for field @id is not selected.', array(
    '@option' => $option,
    '@id' => $id,
  )), t('Browser'));
}