Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Configuring PHPUnit to be run by Sonar

By default, Sonar runs PHPUnit. To configure the execution of PHPUnit, you can set the following properties:

...

Key

...

Default value

...

Description

it is recommended to create a configuration file and set the path to this file with the sonar.phpUnit.configuration

...

property.

If a configuration file is not used, the following property can be set to configure the execution of PHPUnit:

Key

Default value

Description

sonar.phpUnit.ignore.configuration

 false

If true, PHPUnit will ignore any phpunit.xml file for launching the unit tests.
If false, PHPUnit will use any existing phpunit.xml file in the running directory.

sonar.phpUnit.mainTestClass

 

The project main test file including the relative path, ie: "/source/tests/AllTests.php". If not present, PHPUnit will look for phpunit.xml file in the test directory.

sonar.phpUnit.filter

 

Ignore the unit tests files matching this pattern.

sonar.phpUnit.bootstrap

 

Use this bootsrap file to initialize the unit tests.

sonar.phpUnit.analyze.test.directory

 true

If true, Sonar PHP will append test directory to PHPUnit. This will make PHPUnit look for test cases inside this directory. If several directories are defined as test directories, a phpunitRANDOM.xml file will be generated and passed to phpunit --configuration=. This generated file will contain all files inside the test directories.

sonar.phpUnit.group Only runs tests from the specified group(s).
sonar.phpUnit.loader To specify which TestSuiteLoader implementation to use.

...