Phing with PHPUnit 0 tests executed

不羁岁月 提交于 2020-01-05 13:27:43

问题


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?


回答1:


This is because Phing 2.* it's not compatible with new PHPUnit's namespaces.

  • Old namespace: PHPUnit_Framework_TestCase
  • New namespace: PHPUnit\Framework\TestCase

Try using Phing 3: https://www.phing.info/get/phing-3.0.0-alpha1.phar

Source: https://github.com/phingofficial/phing/issues/659



来源:https://stackoverflow.com/questions/50833168/phing-with-phpunit-0-tests-executed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!