You are here

protected function NameTestBase::assertFieldCheckedByName in Name Field 8

Helper function.

@todo Replace calls to this method using Mink's NodeElement::isChecked().

File

tests/src/Functional/NameTestBase.php, line 75

Class

NameTestBase
Helper test class with some added functions for testing.

Namespace

Drupal\Tests\name\Functional

Code

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