protected function DrupalWebTestCase::assertFieldChecked

7.x drupal_web_test_case.php protected DrupalWebTestCase::assertFieldChecked($id, $message = '')

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


$id: Id of field to assert.

$message: Message to display.

Return value

TRUE on pass, FALSE on fail.

12 calls to DrupalWebTestCase::assertFieldChecked()
FormsRebuildTestCase::testRebuildPreservesValues in drupal/modules/simpletest/tests/form.test
Tests preservation of values.
LocaleConfigurationTest::testLanguageConfiguration in drupal/modules/locale/locale.test
Functional tests for adding, editing and deleting languages.
LocaleUserCreationTest::testLocalUserCreation in drupal/modules/locale/locale.test
Functional test for language handling during user creation.
MenuUpgradePathTestCase::testMenuUpgrade in drupal/modules/simpletest/tests/upgrade/
Test a successful upgrade.
MultiStepNodeFormBasicOptionsTest::testMultiStepNodeFormBasicOptions in drupal/modules/node/node.test
Tests changing the default values of basic options to ensure they persist.

... See full list


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


Test case for typical Drupal tests.


protected function assertFieldChecked($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 checked.', array('@id' => $id)), t('Browser'));