Skip to main content

PHP

The following sections provide information on using Testspace with popular PHP test frameworks and tools.

To push collected files simply use the Testspace client:

$ testspace static-analysis-results test-results code-coverage-results

Test Frameworks#

PHPUnit#

PHPUnit is a programmer-oriented testing framework for PHP.

PHPUnit sample: https://github.com/testspace-samples/php.phpunit

Testspace accepts JUnit XML formatted Test results. Here is an example of how to produce such:

phpunit tests --log-junit results.xml

In the Testspace client command-line reference results.xml as "test-results" file.

Code Coverage#

PHPUnit#

The PHPUnit test framework has built-in support for code coverage.

Testspace accepts Clover XML formatted results. Here is an example of how to produce such:

phpunit tests --coverage-clover coverage.xml

In the Testspace client command-line reference coverage.xml as "code-coverage-results" file.

Static Analysis#

PHP_CodeSniffer#

PHP_CodeSniffer is a detector of a defined set of coding standards violations for PHP.

Testspace accepts Checkstyle XML formatted results. Here is an example of how to produce such:

phpcs --report=checkstyle --report-file=analysis.xml /path/to/source

In the Testspace client command-line reference analysis.xml as "static-analysis-results" file.

PHPMD#

PHPMD is a source code analyzer for PHP.

Testspace accepts PMD XML formatted results. Here is an example of how to produce such:

phpmd /path/to/source xml --reportfile=analysis.xml

In the Testspace client command-line reference analysis.xml as "static-analysis-results" file.