You are here

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

File

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

Class

ChoiceFormFieldTest

Namespace

Symfony\Component\DomCrawler\Tests\Field

Code

public function testDisableValidation() {
  $node = $this
    ->createSelectNode(array(
    'foo' => false,
    'bar' => false,
  ));
  $field = new ChoiceFormField($node);
  $field
    ->disableValidation();
  $field
    ->setValue('foobar');
  $this
    ->assertEquals('foobar', $field
    ->getValue(), '->disableValidation() allows to set a value which is not in the selected options.');
  $node = $this
    ->createSelectNode(array(
    'foo' => false,
    'bar' => false,
  ), array(
    'multiple' => 'multiple',
  ));
  $field = new ChoiceFormField($node);
  $field
    ->disableValidation();
  $field
    ->setValue(array(
    'foobar',
  ));
  $this
    ->assertEquals(array(
    'foobar',
  ), $field
    ->getValue(), '->disableValidation() allows to set a value which is not in the selected options.');
}