You are here

protected function DrupalWebTestCase::assertNoFieldChecked in SimpleTest 7

Same name and namespace in other branches
  1. 6.2 drupal_web_test_case.php \DrupalWebTestCase::assertNoFieldChecked()
  2. 7.2 drupal_web_test_case.php \DrupalWebTestCase::assertNoFieldChecked()

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

Parameters

$id: Id of field to assert.

$message: Message to display.

Return value

TRUE on pass, FALSE on fail.

File

./drupal_web_test_case.php, line 2413

Class

DrupalWebTestCase
Test case for typical Drupal tests.

Code

protected function assertNoFieldChecked($id, $message = '') {
  $elements = $this
    ->xpath('//input[@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'));
}