phpro / grumphp

A PHP code-quality tool
MIT License
4.15k stars 431 forks source link

Feature request #445

Closed Kanti closed 6 years ago

Kanti commented 6 years ago
Q A
Version grumphp -V
Bug? no
New feature? yes
Question? yes
Documentation? yes/no
Related tickets -

Since grumphp has different tests and some can fail. We could generate a junit.xml test result.

This could be useful. As an example in Bitbucket Pipelines.

What do you think about such a feature?

Snaver commented 6 years ago

Hey @Kanti

I believe this is already possible! I managed to get this up and running with bitbucket pipelines this week actually.

It's possible to setup without any direct changes to grumphp. What I did was add some additional configuration options to phpunit.xml:

<logging>
    <log type="junit" target="./test-reports/junit.xml" />
</logging>
Kanti commented 6 years ago

Thank you @Snaver.

This is not what I meant. It would be nice if the results of all the tasks run by grumphp are saved into a test-reports/grumphp-junit.xml file. Not the result of the unit tests.

veewee commented 6 years ago

Hello @Kanti,

I am not sure how you would like to structure the data in the junit file since it doesn't matches what GrumPHP does. E.g.: A failure element requires a className, but we are just running external tools so we mostly don't know that info.

You could create reports by adding event listeners to your configuration: https://github.com/phpro/grumphp/blob/master/doc/events.md

Kanti commented 6 years ago

Hmm ok I will look into the event listeners. Thanks a lot!