protected function DrupalWebTestCase::assertFieldChecked in SimpleTest 7.2
Same name and namespace in other branches
- 6.2 drupal_web_test_case.php \DrupalWebTestCase::assertFieldChecked()
- 7 drupal_web_test_case.php \DrupalWebTestCase::assertFieldChecked()
Asserts that a checkbox field in the current page is 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 3168 - Provides DrupalTestCase, DrupalUnitTestCase, and DrupalWebTestCase classes.
Class
- DrupalWebTestCase
- Test case for typical Drupal tests.
Code
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'));
}