You are here

public function ChoiceFormFieldTest::testUntick in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/dom-crawler/Tests/Field/ChoiceFormFieldTest.php \Symfony\Component\DomCrawler\Tests\Field\ChoiceFormFieldTest::testUntick()

File

vendor/symfony/dom-crawler/Tests/Field/ChoiceFormFieldTest.php, line 285

Class

ChoiceFormFieldTest

Namespace

Symfony\Component\DomCrawler\Tests\Field

Code

public function testUntick() {
  $node = $this
    ->createSelectNode(array(
    'foo' => false,
    'bar' => false,
  ));
  $field = new ChoiceFormField($node);
  try {
    $field
      ->untick();
    $this
      ->fail('->untick() throws a \\LogicException for select boxes');
  } catch (\LogicException $e) {
    $this
      ->assertTrue(true, '->untick() throws a \\LogicException for select boxes');
  }
  $node = $this
    ->createNode('input', '', array(
    'type' => 'checkbox',
    'name' => 'name',
    'checked' => 'checked',
  ));
  $field = new ChoiceFormField($node);
  $field
    ->untick();
  $this
    ->assertNull($field
    ->getValue(), '->untick() unticks checkboxes');
}