首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >执行PHPUnit 0测试的Phing

执行PHPUnit 0测试的Phing
EN

Stack Overflow用户
提问于 2018-06-13 09:01:07
回答 1查看 144关注 0票数 1

我正在尝试用phing执行PHPUnit,但是我发现了一些错误。

我的目标是:

代码语言:javascript
复制
  <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>

但当我执行死刑时:

代码语言:javascript
复制
     [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

我不知道为什么要执行0次测试。如果我删除了testX上的错误,

致命错误:找不到类'PHPUnit\Framework\TestCase‘。

所以,当我不放药物的时候,它会发现检测结果,但是如果我把药物定位的话就不起作用了。

错误在哪里?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-06-21 21:12:17

这是因为Phing2.*与新PHPUnit的命名空间不兼容。

  • 旧命名空间:PHPUnit_Framework_TestCase
  • 新命名空间:PHPUnit\Framework\TestCase

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

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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50833168

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档