Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

symfony 2 phpunit - how to untick checkbox in form field

This should be an easy one but I can't find the answer anywhere. I'm using Symfony 2 with phpunit to test my code. Its easy enough to get phpunit to tick a checkbox while running tests:

$form['mycompanyname_companybundle_editsomethingtype[locked]']->tick();

But how do I get it to 'untick' a checkbox?

like image 211
KFCSpike Avatar asked Oct 25 '12 18:10

KFCSpike


1 Answers

You can use Symfony\Component\DomCrawler\Field\ChoiceFormField::untick() for that. In your case it would be

$form['mycompanyname_companybundle_editsomethingtype[locked]']->untick();
like image 142
kgilden Avatar answered Oct 17 '22 01:10

kgilden