简体   繁体   English

使用PHPUnit 0测试执行Phing

[英]Phing with PHPUnit 0 tests executed

I'm trying to execute PHPUnit with phing but i'm finding some errors. 我正在尝试通过phing执行PHPUnit ,但发现了一些错误。

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. 我不知道为什么要执行0个测试。 If i remove the pharlocation i have error on testX, 如果我删除了重新分配,则在testX上出现错误,

Fatal error: Class 'PHPUnit\\Framework\\TestCase' not found. 致命错误:找不到类“ PHPUnit \\ Framework \\ TestCase”。

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. 这是因为Phing 2. *与新的PHPUnit的命名空间不兼容。

  • Old namespace: PHPUnit_Framework_TestCase 旧名称空间: PHPUnit_Framework_TestCase
  • New namespace: PHPUnit\\Framework\\TestCase 新的命名空间: PHPUnit\\Framework\\TestCase

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

Source: https://github.com/phingofficial/phing/issues/659 资料来源: https : //github.com/phingofficial/phing/issues/659

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM