In a functional test of a form to add members of an ArrayCollection there is this statement:
$form['client[members][1][fname]'] = 'Benny';
The field name was verified with a DOM inspector.
The console output at this line is:
InvalidArgumentException: Unreachable field "members"
G:\Documents\workspace\sym\vendor\symfony\symfony\src\Symfony\Component\DomCrawler\Form.php:459
G:\Documents\workspace\sym\vendor\symfony\symfony\src\Symfony\Component\DomCrawler\Form.php:496
G:\Documents\workspace\sym\vendor\symfony\symfony\src\Symfony\Component\DomCrawler\Form.php:319
G:\Documents\workspace\sym\src\Mana\ClientBundle\Tests\Controller\ClientControllerTest.php:57
What method should be used to test the addition of an ArrayCollection member?
Edit as requested (n.b., follow redirects is on):
//link to trigger adding household member form $link = $crawler->selectLink('Add household member')->link(); $crawler = $client->click($link); $form = $crawler->selectButton('Add client')->form(); $form['client[members][1][fname]'] = 'Benny'; $form['client[members][1][dob]'] = "3/12/1999"; $crawler = $client->submit($form); $this->assertTrue($crawler->filter('html:contains("Client View Form")')->count() > 0);