You are here

public function ChoiceFormFieldTest::testTick in Zircon Profile 8

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

File

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

Class

ChoiceFormFieldTest

Namespace

Symfony\Component\DomCrawler\Tests\Field

Code

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