dsyph3r/symblog-docs — Issue #12: PHPUnit with Forms
Author: jaimesuez
Created: 2012-02-11 13:28:56+00:00
State: open

I get the following error:

```
There was 1 error:

1) Blogger\BlogBundle\Tests\Controller\PageControllerTest::testContact
InvalidArgumentException: The form field "blogger_blogbundle_enquirytype[name]" does not exist

/Users/jaimesuez/Sites/symblog/vendor/symfony/src/Symfony/Component/DomCrawler/Form.php:358
/Users/jaimesuez/Sites/symblog/src/Blogger/BlogBundle/Tests/Controller/PageControllerTest.php:48

```

Issue related with this code:

```php
request('GET', '/contact');

$this->assertEquals(1, $crawler->filter('h1:contains("Contact symblog")')->count());

// Select based on button value, or id or name for buttons
$form = $crawler->selectButton('Submit')->form();

$form['blogger_blogbundle_enquirytype[name]'] = 'name';
$form['blogger_blogbundle_enquirytype[email]'] = 'email@email.com';
$form['blogger_blogbundle_enquirytype[subject]'] = 'Subject';
$form['blogger_blogbundle_enquirytype[body]'] = 'The comment body must be at least 50 characters long as there is a validation constrain on the Enquiry entity';

$crawler = $client->submit($form);

$this->assertEquals(1, $crawler->filter('.blogger-notice:contains("Your contact enquiry was successfully sent. Thank you!")')->count());
}
```