You are here

public function CheckboxTest::testSetValue in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/behat/mink/driver-testsuite/tests/Form/CheckboxTest.php \Behat\Mink\Tests\Driver\Form\CheckboxTest::testSetValue()

File

vendor/behat/mink/driver-testsuite/tests/Form/CheckboxTest.php, line 29

Class

CheckboxTest

Namespace

Behat\Mink\Tests\Driver\Form

Code

public function testSetValue() {
  $this
    ->getSession()
    ->visit($this
    ->pathTo('advanced_form.html'));
  $checkbox = $this
    ->getAssertSession()
    ->fieldExists('agreement');
  $this
    ->assertNull($checkbox
    ->getValue());
  $this
    ->assertFalse($checkbox
    ->isChecked());
  $checkbox
    ->setValue(true);
  $this
    ->assertEquals('yes', $checkbox
    ->getValue());
  $this
    ->assertTrue($checkbox
    ->isChecked());
  $checkbox
    ->setValue(false);
  $this
    ->assertNull($checkbox
    ->getValue());
  $this
    ->assertFalse($checkbox
    ->isChecked());
}