问题描述
我正在尝试通过phing执行PHPUnit
,但是我发现了一些错误.
I'm trying to execute PHPUnit
with phing but i'm finding some errors.
我有我的目标:
<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
我不知道为什么要执行0个测试.如果我删除了重新分配,则在testX上出现错误,
I don't know why 0 tests executed. If i remove the pharlocation i have error on testX,
因此,当我不放置重定位功能时,它会进行测试,但是如果我放置重定位功能,它将无法正常工作.
So, when i don't put pharlocation it found tests, but if i put pharlocation it doesn't work.
错误在哪里?
推荐答案
这是因为Phing 2. *与新的PHPUnit命名空间不兼容.
This is because Phing 2.* it's not compatible with new PHPUnit's namespaces.
- 旧命名空间:
PHPUnit_Framework_TestCase
- 新名称空间:
PHPUnit\Framework\TestCase
- Old namespace:
PHPUnit_Framework_TestCase
- New namespace:
PHPUnit\Framework\TestCase
尝试使用Phing 3: https://www.phing. info/get/phing-3.0.0-alpha1.phar
Try using Phing 3: https://www.phing.info/get/phing-3.0.0-alpha1.phar
来源: https://github.com/phingofficial/phing/issues/659
这篇关于使用PHPUnit 0测试执行Phing的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!