You are here

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

__construct() should throw \\LogicException if the form attribute is invalid.

@expectedException \LogicException

File

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

Class

FormTest

Namespace

Symfony\Component\DomCrawler\Tests

Code

public function testConstructorThrowsExceptionIfNoRelatedForm() {
  $dom = new \DOMDocument();
  $dom
    ->loadHTML('
            <html>
                <form id="bar">
                    <input type="submit" form="nonexistent" />
                </form>
                <input type="text" form="nonexistent" />
                <button />
            </html>
        ');
  $nodes = $dom
    ->getElementsByTagName('input');
  $form = new Form($nodes
    ->item(0), 'http://example.com');
  $form = new Form($nodes
    ->item(1), 'http://example.com');
}