function DrupalWebTestCase::assertNoFieldChecked

Asserts that a checkbox field in the current page is not checked.

Parameters

$id: ID of field to assert.

$message: (optional) Message to display.

Return value

TRUE on pass, FALSE on fail.

12 calls to DrupalWebTestCase::assertNoFieldChecked()
FormsRebuildTestCase::testRebuildPreservesValues in modules/simpletest/tests/form.test
Tests preservation of values.
FormsTestCase::testRequiredCheckboxesRadio in modules/simpletest/tests/form.test
Tests validation for required checkbox, select, and radio elements.
LocaleConfigurationTest::testLanguageConfiguration in modules/locale/locale.test
Functional tests for adding, editing and deleting languages.
MenuUpgradePathTestCase::testMenuUpgrade in modules/simpletest/tests/upgrade/upgrade.menu.test
Test a successful upgrade.
MultiStepNodeFormBasicOptionsTest::testMultiStepNodeFormBasicOptions in modules/node/node.test
Tests changing the default values of basic options to ensure they persist.

... See full list

File

modules/simpletest/drupal_web_test_case.php, line 3810

Class

DrupalWebTestCase
Test case for typical Drupal tests.

Code

protected function assertNoFieldChecked($id, $message = '') {
    $elements = $this->xpath('//input[@id=:id]', array(
        ':id' => $id,
    ));
    return $this->assertTrue(isset($elements[0]) && empty($elements[0]['checked']), $message ? $message : t('Checkbox field @id is not checked.', array(
        '@id' => $id,
    )), t('Browser'));
}

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