DrupalWebTestCase::assertFieldChecked

  1. drupal
    1. 8
    2. 7
Versions
7 protected DrupalWebTestCase::assertFieldChecked($id, $message = '')

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.

Code

modules/simpletest/drupal_web_test_case.php, line 3130

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