#25854 closed enhancement (fixed)
PHPUnit Configuration for Grunt
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 3.8 | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Build/Test Tools | Keywords: | has-patch |
| Focuses: | Cc: |
Description
I've taken a stab at creating some Grunt tasks for our PHPUnit tests to go along with our QUnit tests.
Note that I did attempt to use grunt-phpunit, however, it appears to not be very mature, and requires configuring the directory location for tests. We make use of more advanced features through the configuration file (stuff like phpVersion requirements) that aren't supported with this Grunt plugin yet. See also issue #9.
Instead, this patch just makes quick and dirty use of grunt.util.spawn to provide the self-explanatory phpunit:default, phpunit:ajax, and phpunit:multisite tasks.
I've also taken the liberty of adding the phpunit:default task to the generic test task along with qunit.
Since this gives developers another way to run the PHPUnit tests from the root folder, I've moved the phpunit.xml.dist file back into the tests/phpunit folder out of the way (where it's still possible to run "phpunit" directly).
I think we could easily leave phpunit.xml.dist where it is, at least for the moment. The benefit being that we're already used to running
phpunitfrom the root, so we should probably keep it that way. We've been trying to emphasize that tests and the source are just two pieces of the same pie, hence committing both sides in the same commit. At least for me, it's also fairly common to "idle" on the command line at the root of the repository (sometimes opening files in src, other times in tests, and eventually in tools as well) and run tests from there. grunt gives us the opportunity to run them from anywhere, but I don't think we need to switch up our test instructions yet again just yet.