You are here

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

File

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

Class

ChoiceFormFieldTest

Namespace

Symfony\Component\DomCrawler\Tests\Field

Code

public function testIsMultiple() {
  $node = $this
    ->createNode('input', '', array(
    'type' => 'radio',
    'name' => 'name',
    'value' => 'foo',
  ));
  $field = new ChoiceFormField($node);
  $this
    ->assertFalse($field
    ->isMultiple(), '->isMultiple() returns false for radio buttons');
  $node = $this
    ->createNode('input', '', array(
    'type' => 'checkbox',
    'name' => 'name',
    'value' => 'foo',
  ));
  $field = new ChoiceFormField($node);
  $this
    ->assertFalse($field
    ->isMultiple(), '->isMultiple() returns false for checkboxes');
  $node = $this
    ->createNode('select', '');
  $field = new ChoiceFormField($node);
  $this
    ->assertFalse($field
    ->isMultiple(), '->isMultiple() returns false for selects without the multiple attribute');
  $node = $this
    ->createNode('select', '', array(
    'multiple' => 'multiple',
  ));
  $field = new ChoiceFormField($node);
  $this
    ->assertTrue($field
    ->isMultiple(), '->isMultiple() returns true for selects with the multiple attribute');
  $node = $this
    ->createNode('select', '', array(
    'multiple' => '',
  ));
  $field = new ChoiceFormField($node);
  $this
    ->assertTrue($field
    ->isMultiple(), '->isMultiple() returns true for selects with an empty multiple attribute');
}