fb310e7b |
1 | <?php |
2 | |
3 | /** |
4 | * @group headless |
5 | */ |
6 | class CRM_Core_FormTest extends CiviUnitTestCase { |
7 | |
8 | /** |
9 | * Simulate opening various forms. All we're looking to do here is |
10 | * see if any warnings or notices come up, the equivalent of red boxes |
11 | * on the screen, but which are hidden when using popup forms. |
12 | * So no assertions required. |
13 | * |
14 | * @param string $classname |
15 | * @dataProvider formClassList |
16 | */ |
17 | public function testOpeningForms(string $classname) { |
18 | $form = $this->getFormObject($classname); |
19 | $form->preProcess(); |
20 | $form->buildQuickForm(); |
21 | $form->setDefaultValues(); |
22 | $form->assign('action', CRM_Core_Action::UPDATE); |
23 | $form->getTemplate()->fetch($form->getTemplateFileName()); |
24 | } |
25 | |
26 | /** |
27 | * Dataprovider for testOpeningForms(). |
28 | * TODO: Add more forms! Use a descriptive array key so when it fails |
29 | * it will make it clearer what form it is, although you'll see the class |
30 | * anyway. |
31 | */ |
32 | public function formClassList() { |
33 | return [ |
34 | 'Add New Tag' => ['CRM_Tag_Form_Edit'], |
35 | ]; |
36 | } |
37 | |
38 | } |