Add basic support for `ang/*.test.php` test suite.
authorTim Otten <totten@civicrm.org>
Wed, 10 Feb 2021 22:22:36 +0000 (14:22 -0800)
committerTim Otten <totten@civicrm.org>
Wed, 17 Feb 2021 09:24:25 +0000 (01:24 -0800)
commit1cf6f5e1194ae72727f99a57a07d360ea4e369ef
tree65bf114d56d5d6759b57f47f73872d28f38665de
parent23dc14a74c12b0e6e10e4e046b9d4095b9651344
Add basic support for `ang/*.test.php` test suite.

The previous pattern was to put all tests in `tests/phpunit/`. They would use
fixtures in a few ways, eg

* Work with example forms from the `ang/` folder. This is useful for testing specific configurations/features
  (e.g. if a form is configured with `permission` of `X`, then the form should behave accordingly).
* Dynamically create/destroy forms. This is useful for testing the API mechanism (eg ensuring the `Afform.create`
  and `Afform.revert` actually do create and revert things).

The two styles are both necessary. However:

1. The first style is easer to work with -- if a form fails its test, then
   you can run that form interactively.  If you want to add a new test-case,
   you can simply copy in a working example -- you don't need to code-up
   some PHPUnit logic to build the example.

2. If you have something written in the first style, then it's easier keep
   the `*.aff.html` and the PHPUnit `*.php` next to each other.
ext/afform/mock/phpunit.xml.dist
ext/afform/mock/tests/phpunit/Civi/AfformMock/FormTestCase.php [new file with mode: 0644]