$buttonElements =
$dom->
getElementsByTagName('button'
);
$form =
new Form($nodes->
item(0
), 'http://example.com'
);
$this->
assertCount(3,
$form->
all());
$form =
new Form($buttonElements->
item(1
), 'http://example.com'
);
$this->
assertCount(5,
$form->
all());
} 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'
);