Versions Compared

Key

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

...

  1. Install the PHP Environment
  2. Install the plugin through the Update Center or download it into the SONARQUBE_HOME/extensions/plugins directory
  3. Restart the SonarQube server

Usage

Run anAnalysis an Analysis with the SonarQube Runner (Recommended method)

To run an analysis of your PHP project, use the SonarQube Runner.

Sample projects are A sample project is available on GitHub that can be browsed or downloaded: /projects/languages/php/php-sonar-runner.

You can also have a look at the SonarQube Runner documentation page to define a multi-module PHP project.

...

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, it 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.

A sample project is available on GitHub that can be browsed or downloaded/projects/languages/php/php-sonar-runner-unit-tests.

Reusing existing reports

To reuse existing reports from PHP Depend, PHPUnit, etc.:

...

  1. PHP 1.2 - short-term activity (see the JIRA open tickets)
    1. Improve the PHP CodeSniffer rule repository (adding missing parameters, descriptions, ...)
    2. Work on the "Sonar Way", PEAR and Zend profiles (<= for PHP gurus! (wink) )
  2. PHP 2.0 - mid-term activity
    1. Handle multiple files with the same name
    2. Consider root folders as "Projects"
    3. Non structured PHP files
    4. If it turns out that those tickets are technically difficult/long to implement, then they can be postponed

Change Log

JIRA Issues
anonymoustrue
titleVersion 1.2
height110
renderModestatic
width900
columnstype;key;summary;priority
urlhttp://jira.codehaus.org/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?jqlQuery=project+%3D+SONARPLUGINS+AND+fixVersion+%3D+"PHP-1.2"+AND+component+%3D+PHP+AND+status+%3D+Closed+ORDER+BY+priority+DESC&tempMax=1000

 

JIRA Issues
anonymoustrue
titleVersion 1.1
height110
renderModestatic
width900
columnstype;key;summary;priority
urlhttp://jira.codehaus.org/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?jqlQuery=project+%3D+SONARPLUGINS+AND+fixVersion+%3D+"PHP-1.1"+AND+component+%3D+PHP+AND+status+%3D+Closed+ORDER+BY+priority+DESC&tempMax=1000

 

JIRA Issues
anonymoustrue
titleVersion 1.0
height110
renderModestatic
width900
columnstype;key;summary;priority
urlhttp://jira.codehaus.org/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?jqlQuery=project+%3D+SONARPLUGINS+AND+fixVersion+%3D+"PHP-1.0"+AND+component+%3D+PHP+AND+status+%3D+Closed+ORDER+BY+priority+DESC&tempMax=1000