You are here

public function FormTest::testFormRegistrySetValues in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/dom-crawler/Tests/FormTest.php \Symfony\Component\DomCrawler\Tests\FormTest::testFormRegistrySetValues()

File

vendor/symfony/dom-crawler/Tests/FormTest.php, line 772

Class

FormTest

Namespace

Symfony\Component\DomCrawler\Tests

Code

public function testFormRegistrySetValues() {
  $registry = new FormFieldRegistry();
  $registry
    ->add($f2 = $this
    ->getFormFieldMock('foo[2]'));
  $registry
    ->add($f3 = $this
    ->getFormFieldMock('foo[3]'));
  $registry
    ->add($fbb = $this
    ->getFormFieldMock('foo[bar][baz]'));
  $f2
    ->expects($this
    ->exactly(2))
    ->method('setValue')
    ->with(2);
  $f3
    ->expects($this
    ->exactly(2))
    ->method('setValue')
    ->with(3);
  $fbb
    ->expects($this
    ->exactly(2))
    ->method('setValue')
    ->with('fbb');
  $registry
    ->set('foo[2]', 2);
  $registry
    ->set('foo[3]', 3);
  $registry
    ->set('foo[bar][baz]', 'fbb');
  $registry
    ->set('foo', array(
    2 => 2,
    3 => 3,
    'bar' => array(
      'baz' => 'fbb',
    ),
  ));
}