Skip to content

Instantly share code, notes, and snippets.

@JoshuaEstes
Created June 3, 2013 16:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JoshuaEstes/5699385 to your computer and use it in GitHub Desktop.
Save JoshuaEstes/5699385 to your computer and use it in GitHub Desktop.
Symfony2 Functional Form Tests
<form id="that-one-form">
{{ form_widget(form) }}
</form>
<?php
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class formTest extends WebTestCase
{
public function testForm()
{
$client = static::createClient();
$crawler = $client->request('GET', $client->getContainer()->get('router')->generate('route_name_to_that_form'));
$form = $crawler->filter('#that-one-form')->eq(0)->form();
$client->submit(
$form,
array_merge(
$form->getValues(),
array(
'form[name]' => 'Joshua Estes',
)
)
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment