function MenuTestCase::assertNoOption

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 MenuTestCase::assertNoOption()
MenuTestCase::addMenuLink in modules/menu/menu.test
Add a menu link using the menu module UI.

File

modules/menu/menu.test, line 699

Class

MenuTestCase
@file Tests for menu.module.

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'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.