I always get the following error when I try to fill out a form with PHPUnit Functional Testing: LogicException: The selected node does not have a form ancestor. error with symfony2 phpunit testing
Here is the code, the error shows up at the last line of code:
$editusercrawler = $client->request('GET', '/profile');
$this->assertTrue($editusercrawler->filter('html:contains("Edit Profile")')->count() > 0);
// Go To Edit
$link = $editusercrawler->filter('a:contains("Edit Profile")')->eq(0)->link();
$editusercrawler = $client->click($link);
//var_dump($client->getResponse()->getContent());
// Check if User Edit was called
$this->assertTrue($editusercrawler->filter('html:contains("Edit User")')->count() > 0);
//var_dump($client->getResponse()->getContent());
// Fill out form
//var_dump($client->getResponse()->getContent());
$editusercrawler = $client->click($link);
$editusercrawler = $client->request('GET', '/profile/edit');
var_dump($client->getResponse()->getContent());
$editUserForm = $editusercrawler->selectButton('update')->form();