You are here

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

File

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

Class

ChoiceFormFieldTest

Namespace

Symfony\Component\DomCrawler\Tests\Field

Code

public function testRadioButtonIsDisabled() {
  $node = $this
    ->createNode('input', '', array(
    'type' => 'radio',
    'name' => 'name',
    'value' => 'foo',
    'disabled' => 'disabled',
  ));
  $field = new ChoiceFormField($node);
  $node = $this
    ->createNode('input', '', array(
    'type' => 'radio',
    'name' => 'name',
    'value' => 'bar',
  ));
  $field
    ->addChoice($node);
  $node = $this
    ->createNode('input', '', array(
    'type' => 'radio',
    'name' => 'name',
    'value' => 'baz',
    'disabled' => '',
  ));
  $field
    ->addChoice($node);
  $field
    ->select('foo');
  $this
    ->assertEquals('foo', $field
    ->getValue(), '->getValue() returns the value attribute of the selected radio button');
  $this
    ->assertTrue($field
    ->isDisabled());
  $field
    ->select('bar');
  $this
    ->assertEquals('bar', $field
    ->getValue(), '->getValue() returns the value attribute of the selected radio button');
  $this
    ->assertFalse($field
    ->isDisabled());
  $field
    ->select('baz');
  $this
    ->assertEquals('baz', $field
    ->getValue(), '->getValue() returns the value attribute of the selected radio button');
  $this
    ->assertTrue($field
    ->isDisabled());
}