You are here

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

File

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

Class

ChoiceFormFieldTest

Namespace

Symfony\Component\DomCrawler\Tests\Field

Code

public function testSelect() {
  $node = $this
    ->createNode('input', '', array(
    'type' => 'checkbox',
    'name' => 'name',
    'checked' => 'checked',
  ));
  $field = new ChoiceFormField($node);
  $field
    ->select(true);
  $this
    ->assertEquals('on', $field
    ->getValue(), '->select() changes the value of the field');
  $field
    ->select(false);
  $this
    ->assertNull($field
    ->getValue(), '->select() changes the value of the field');
  $node = $this
    ->createSelectNode(array(
    'foo' => false,
    'bar' => false,
  ));
  $field = new ChoiceFormField($node);
  $field
    ->select('foo');
  $this
    ->assertEquals('foo', $field
    ->getValue(), '->select() changes the selected option');
}