2016-07-19 11:12:28 +02:00
|
|
|
Plugin PHPUnit
|
2017-01-04 13:22:20 +01:00
|
|
|
==============
|
2016-07-19 11:12:28 +02:00
|
|
|
|
2016-07-17 16:20:35 +02:00
|
|
|
Runs PHPUnit tests against your build.
|
2016-07-19 11:12:28 +02:00
|
|
|
|
|
|
|
Configuration
|
2017-01-04 13:22:20 +01:00
|
|
|
-------------
|
2016-07-19 11:12:28 +02:00
|
|
|
|
2016-07-17 16:20:35 +02:00
|
|
|
### Options
|
2016-07-19 11:12:28 +02:00
|
|
|
|
2016-07-17 16:20:35 +02:00
|
|
|
Has two modes:
|
|
|
|
|
|
|
|
#### phpunit.xml Configuration File
|
2016-07-19 11:12:28 +02:00
|
|
|
|
2016-07-17 16:20:35 +02:00
|
|
|
Its activated if you have phpunit.xml file in your build path, `tests/` subfolder, or you specify it as a parameter:
|
|
|
|
* **config** - Optional - Path to a PHP Unit XML configuration file.
|
|
|
|
* **run_from** - Optional - When running PHPUnit with an XML config, the command is run from this directory
|
|
|
|
* **coverage** - Optional - Value for the `--coverage-html` command line flag.
|
2017-07-18 15:54:24 +02:00
|
|
|
* **path** - Optional - In cases where tests files are in a sub path of the /tests path, allows this path to be set in
|
|
|
|
the config.
|
2016-07-17 16:20:35 +02:00
|
|
|
|
|
|
|
#### Running Tests By Specifying Directory
|
2016-07-19 11:12:28 +02:00
|
|
|
|
2016-07-17 16:20:35 +02:00
|
|
|
* **directory** - Optional - The directory (or array of dirs) to run PHPUnit on
|
|
|
|
|
|
|
|
Both modes accept:
|
|
|
|
* **args** - Optional - Command line args (in string format) to pass to PHP Unit
|
|
|
|
|
|
|
|
### Examples
|
2016-07-19 11:12:28 +02:00
|
|
|
|
2016-07-17 16:20:35 +02:00
|
|
|
Specify config file and test directory:
|
|
|
|
```yml
|
|
|
|
test:
|
|
|
|
php_unit:
|
|
|
|
config:
|
|
|
|
- "path/to/phpunit.xml"
|
|
|
|
path: "app/tests/"
|
2018-01-20 10:32:18 +01:00
|
|
|
coverage: true
|
2016-07-17 16:20:35 +02:00
|
|
|
```
|
|
|
|
|
2016-07-19 11:12:28 +02:00
|
|
|
Troubleshooting
|
2017-01-04 13:22:20 +01:00
|
|
|
---------------
|
2016-07-19 11:12:28 +02:00
|
|
|
|
2017-07-18 15:54:24 +02:00
|
|
|
If standard logging of PHP Censor is not enough, to get standard output from any command, including PHPUnit, edit
|
2017-07-19 05:26:51 +02:00
|
|
|
`CommandExecutor::executeCommand()` to see what exactly is wrong
|
2016-07-19 13:05:02 +02:00
|
|
|
* Run `composer update` in phpunit plugin directory of PHP Censor to get all of its dependencies
|
|
|
|
* If phpunit is inside of the project's composer.json, it might interfere with PHP Censor's phpunit installation
|
2016-07-17 16:20:35 +02:00
|
|
|
* Make sure you have XDebug installed.`The Xdebug extension is not loaded. No code coverage will be generated.`
|
2017-07-18 15:54:24 +02:00
|
|
|
Otherwise test report parsing in `TapParser` will fail, wanting coverage report as well `Invalid TAP string, number of
|
|
|
|
tests does not match specified test count.`
|