FMCorz / mdk

Moodle Development Kit. A collection of tools meant to make developers' lives easier.
GNU General Public License v3.0
85 stars 47 forks source link

Add testsuite coverage to phpunit #101

Closed andrewnicols closed 9 years ago

andrewnicols commented 9 years ago

In Moodle, we put all of our test directories into testsuites. For example, the message/tests directory is defined in the core_message_testsuite testsuite.

Because of our naming scheme for files, we cannot simply pass the directory as this only looks for files with the suffix Test.php. We can however make use of the testsuite option to phpunit.

Suites are named as per their frankenstyle component and the complete list can be found in the generated phpunit.xml configration. Here's an excerpt for the above example:

<testsuite name="core_message_testsuite">
    <directory suffix="_test.php">message/tests</directory>
</testsuite>

With this change, it becomes possible to run all tests for an entire component quickly and easily:

mdk phpunit -s core_message_testsuite
FMCorz commented 9 years ago

Awesome, thanks Andrew.