You are here

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

File

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

Class

FormTest

Namespace

Symfony\Component\DomCrawler\Tests

Code

public function testGetMethod() {
  $form = $this
    ->createForm('<form><input type="submit" /></form>');
  $this
    ->assertEquals('GET', $form
    ->getMethod(), '->getMethod() returns get if no method is defined');
  $form = $this
    ->createForm('<form method="post"><input type="submit" /></form>');
  $this
    ->assertEquals('POST', $form
    ->getMethod(), '->getMethod() returns the method attribute value of the form');
  $form = $this
    ->createForm('<form method="post"><input type="submit" /></form>', 'put');
  $this
    ->assertEquals('PUT', $form
    ->getMethod(), '->getMethod() returns the method defined in the constructor if provided');
  $form = $this
    ->createForm('<form method="post"><input type="submit" /></form>', 'delete');
  $this
    ->assertEquals('DELETE', $form
    ->getMethod(), '->getMethod() returns the method defined in the constructor if provided');
  $form = $this
    ->createForm('<form method="post"><input type="submit" /></form>', 'patch');
  $this
    ->assertEquals('PATCH', $form
    ->getMethod(), '->getMethod() returns the method defined in the constructor if provided');
}