R: Sonar + PHP Unit

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

R: Sonar + PHP Unit

Emiliano Bacci

Hello everyone,

I’ve received no answer, so we’ve struggled to find out a workaround, that I report here (it’s horrible in my opinion).


First, we’ve blocked sonar from performing any PHPUnit analysis (since it is not able to do it on the right folder!):








Second, we’ve forced Sonar to work on the maven output directory (as it should do for tests, actually).

-Dproject.source.dir=<output folder>


Hope this will help someone as future reference.


I am really discouraged since I’ve got no answer in more than a couple of months on the mailing list mentioned by sonar as the place where to get any kind of support.

I think that my issue is potentially related to a bad design error in the PHP plugin, so I hope to have set the cat among the pigeons.



Emiliano Bacci



Da: Emiliano Bacci [mailto:[hidden email]]
Inviato: mercoledì 12 settembre 2012 11:49
A: '[hidden email]'
Oggetto: Sonar + PHP Unit



my company is attempting to use Sonar and Maven to manage PHP-based web projects.

Since we have to deploy the projects in different environments, we have taken advantage of the resource filtering capabilities of Maven so to create different installations based on Maven profiles.


Now, the project layout is as follows:

·         Src

o   Main

§  Php

§  Resources

o   Test

§  Php

§  Resources

o   Site


All resources (both folders) are filtered before being copied to the target folder.

The command mvn test (through PHP Maven plugin) makes PHPUnit work on the folder target/test-classes.

However, mvn sonar:sonar invokes PHPUnit on the maven testSourceDirectory, so the test obsiously fail because any reference to the resources is invalid.


In my understanding Sonar plugin should invoke PHPUnit on target/test-classes, do you agree with me?

Actually I have not found any way to achieve this.

Can you help me in this?


Thanks for your support,


Emiliano Bacci