I'm trying to execute PHPUnit
with phing but i'm finding some errors.
I have my target:
<target name="tests">
<phpunit pharlocation="C:/xampp/php/phpunit.phar" printsummary="true" haltonfailure="true" haltonerror="true">
<formatter type="xml" usefile="false"/>
<batchtest>
<fileset dir=".">
<include name="tests/*Test*.php"/>
</fileset>
</batchtest>
</phpunit>
</target>
But when i execute i have:
[phpunit] <?xml version="1.0" encoding="UTF-8"?>
[phpunit] <testsuites>
[phpunit] <testsuite name="AllTests" tests="0" assertions="0" failures="0" errors="0" time="0.000000"/>
[phpunit] </testsuites>
[phpunit] Total tests run: 0, Failures: 0, Errors: 0, Incomplete: 0, Skipped: 0, Time elapsed: 0.00496 s
I don't know why 0 tests executed. If i remove the pharlocation i have error on testX,
Fatal error: Class 'PHPUnit\Framework\TestCase' not found.
So, when i don't put pharlocation it found tests, but if i put pharlocation it doesn't work.
Where is the error?
This is because Phing 2.* it's not compatible with new PHPUnit's namespaces.
PHPUnit_Framework_TestCase
PHPUnit\Framework\TestCase
Try using Phing 3: https://www.phing.info/get/phing-3.0.0-alpha1.phar