问题
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?
回答1:
You can use Symfony\Component\DomCrawler\Field\ChoiceFormField::untick() for that. In your case it would be
$form['mycompanyname_companybundle_editsomethingtype[locked]']->untick();
来源:https://stackoverflow.com/questions/13074889/symfony-2-phpunit-how-to-untick-checkbox-in-form-field