symfony 2 phpunit - how to untick checkbox in form field

半世苍凉 提交于 2019-12-23 12:24:14

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!