public function testGetFormNode() { $dom = new \DOMDocument(); $dom->loadHTML('<html><form><input type="submit" /></form></html>'); $form = new Form($dom->getElementsByTagName('input')->item(0)); $this->assertSame($dom->getElementsByTagName('form')->item(0), $form->getFormNode(), '->getFormNode() returns the form node associated with this form'); }
/** * Returns a Form object for the first node in the list. * * @param array $arguments An array of values for the form fields * @param string $method The method for the form * * @return Form A Form instance * * @throws \InvalidArgumentException If the current node list is empty */ public function form(array $values = null, $method = null) { if (!count($this)) { throw new \InvalidArgumentException('The current node list is empty.'); } $form = new Form($this->getNode(0), $method, $this->host, $this->path); if (null !== $values) { $form->setValues($values); } return $form; }
/** * Submits a form. * * @param Symfony\Components\BrowserKit\Form $form A Form instance * @param array $values An array of form field values */ public function submit(Form $form, array $values = array()) { $form->setValues($values); return $this->request($form->getMethod(), $form->getUri(), $form->getPhpValues(), array(), $form->getPhpFiles()); }