You are here

public function FormTest::testConstructorHandlesFormAttribute 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::testConstructorHandlesFormAttribute()

File

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

Class

FormTest

Namespace

Symfony\Component\DomCrawler\Tests

Code

public function testConstructorHandlesFormAttribute() {
  $dom = $this
    ->createTestHtml5Form();
  $inputElements = $dom
    ->getElementsByTagName('input');
  $buttonElements = $dom
    ->getElementsByTagName('button');

  // Tests if submit buttons are correctly assigned to forms
  $form1 = new Form($buttonElements
    ->item(1), 'http://example.com');
  $this
    ->assertSame($dom
    ->getElementsByTagName('form')
    ->item(0), $form1
    ->getFormNode(), 'HTML5-compliant form attribute handled incorrectly');
  $form1 = new Form($inputElements
    ->item(3), 'http://example.com');
  $this
    ->assertSame($dom
    ->getElementsByTagName('form')
    ->item(0), $form1
    ->getFormNode(), 'HTML5-compliant form attribute handled incorrectly');
  $form2 = new Form($buttonElements
    ->item(0), 'http://example.com');
  $this
    ->assertSame($dom
    ->getElementsByTagName('form')
    ->item(1), $form2
    ->getFormNode(), 'HTML5-compliant form attribute handled incorrectly');
}