You are here

public function ChoiceFormFieldTest::testInitialize 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::testInitialize()

File

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

Class

ChoiceFormFieldTest

Namespace

Symfony\Component\DomCrawler\Tests\Field

Code

public function testInitialize() {
  $node = $this
    ->createNode('textarea', '');
  try {
    $field = new ChoiceFormField($node);
    $this
      ->fail('->initialize() throws a \\LogicException if the node is not an input or a select');
  } catch (\LogicException $e) {
    $this
      ->assertTrue(true, '->initialize() throws a \\LogicException if the node is not an input or a select');
  }
  $node = $this
    ->createNode('input', '', array(
    'type' => 'text',
  ));
  try {
    $field = new ChoiceFormField($node);
    $this
      ->fail('->initialize() throws a \\LogicException if the node is an input with a type different from checkbox or radio');
  } catch (\LogicException $e) {
    $this
      ->assertTrue(true, '->initialize() throws a \\LogicException if the node is an input with a type different from checkbox or radio');
  }
}