You are here

protected function MenuNodeTestCase::assertNoOption in Drupal 7

Asserts that a select option in the current page does not exist.

@todo move to simpletest drupal_web_test_case.php.

Parameters

$id: Id of select field to assert.

$option: Option to assert.

$message: Message to display.

Return value

TRUE on pass, FALSE on fail.

1 call to MenuNodeTestCase::assertNoOption()
MenuNodeTestCase::testMenuNodeFormWidget in modules/menu/menu.test
Test creating, editing, deleting menu links via node form widget.

File

modules/menu/menu.test, line 830
Tests for menu.module.

Class

MenuNodeTestCase
Test menu settings for nodes.

Code

protected function assertNoOption($id, $option, $message = '') {
  $selects = $this
    ->xpath('//select[@id=:id]', array(
    ':id' => $id,
  ));
  $options = $this
    ->xpath('//select[@id=:id]//option[@value=:option]', array(
    ':id' => $id,
    ':option' => $option,
  ));
  return $this
    ->assertTrue(isset($selects[0]) && !isset($options[0]), $message ? $message : t('Option @option for field @id does not exist.', array(
    '@option' => $option,
    '@id' => $id,
  )), t('Browser'));
}