5
votes

Jenkins version - 2.22

Phing version - 0.13.3

PHPUnit version - 5.7.19

phpunit.xml

<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
         backupStaticAttributes="false"
         bootstrap="bootstrap/autoload.php"
         colors="true"
         convertErrorsToExceptions="true"
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true"
         processIsolation="false"
         stopOnFailure="false">
    <testsuites>
        <testsuite name="Application Test Suite">
            <directory suffix="Test.php">./tests</directory>
        </testsuite>
    </testsuites>
    <filter>
        <whitelist processUncoveredFilesFromWhitelist="true">
            <directory suffix=".php">./app/Managers</directory>
        </whitelist>
    </filter>
    <php>
        <env name="APP_ENV" value="testing"/>
        <env name="CACHE_DRIVER" value="array"/>
        <env name="SESSION_DRIVER" value="array"/>
        <env name="QUEUE_DRIVER" value="sync"/>
    </php>
</phpunit>

build.xml

...
<coverage-setup database="./report/coverage/database">
    <fileset id="coverageFileSet" dir="./app/Managers">
        <include name="**/*Manager*.php" />
    </fileset>
</coverage-setup>
<phpunit pharlocation="./vendor/phpunit/phpunit/phpunit" configuration="./phpunit.xml" printsummary="true" haltonerror="true" haltonfailure="true" codecoverage="true">
    <formatter type="clover" outfile="report/coverage/clover.xml"/>
</phpunit>
<coverage-report outfile="report/coverage/coverage.xml">
    <report todir="report/coverage"/>
</coverage-report>
...

When I run the phing target in Jenkins, I get following error. unrecognized option -- b

What am I doing wrong? or any help how to debug this issue ?

Note - This is laravel-5.4 application and when I run phpunit from application's root folder its working.

1
The message unrecognized option -- b obviously originates from PHPUnit. Maybe the Phing task uses it the wrong way?Joe
@Joe yes, but I wonder If I'm doing it wrong? Any way I can find what is that option b, it may helpful to find the issueSaumini Navaratnam
Sounds pretty much like this Issue. According to the commit mentioned there it might work with an older version of PHPUnit (< 4.8).Joe
Running phing -verbose or even phing -debug might reveal the options phing actually uses to start phpunit. Maybe you'll find your b there.Joe

1 Answers

0
votes

You said you are using Phing version - 0.13.3, which is not very plausible. You should try using Phing 3.0.0-alpha3, it has a lot of improvements.

Also, I think the following answer can help you: Phing and PHPUnit, just cant get even the most basic thing running