phpunit/excluded文件仍返回警告
使用版本8.1.6,并给出以下phpunit.xml:phpunit/excluded文件仍返回警告,php,phpunit,Php,Phpunit,使用版本8.1.6,并给出以下phpunit.xml: <phpunit bootstrap="vendor/autoload.php"> <testsuites> <testsuite name="SlimSkeleton"> <directory>tests</directory> <exclude>./tests/Functional/BaseTestCase.php</exc
<phpunit bootstrap="vendor/autoload.php">
<testsuites>
<testsuite name="SlimSkeleton">
<directory>tests</directory>
<exclude>./tests/Functional/BaseTestCase.php</exclude>
</testsuite>
</testsuites>
</phpunit>
我通过composer.json中的脚本命令运行Suiter:
{
...
"scripts": {
"test": "phpunit"
}
}
这是预期的吗?有没有办法使此警告静音?phpunit默认会找到
*Test.php
,因此即使phpunit.xml中没有
,它也会通过运行composer Test来忽略BaseTestCase.php
使用tests而不是tests/EmailTest将指示PHPUnit命令行测试运行程序执行tests目录中*test.php源代码文件中声明的所有测试
如果我像下面这样指定命令行参数,我会看到“找不到测试”警告。但这不是的预期用途
您使用的PHP单元版本到底是什么?@Jimmix是在原始文章(8.1.6)中添加的,其中dir结构的一部分是文件phpunit.xml
?您是否也尝试过使用/tests
?在dame级别,您是否尝试过将BaseTestCase
制作成抽象类?
{
...
"scripts": {
"test": "phpunit"
}
}
$ composer test tests/Functional/BaseTestCase.php
> phpunit 'tests/Functional/BaseTestCase.php'
PHPUnit 8.1.6 by Sebastian Bergmann and contributors.
W 1 / 1 (100%)
Time: 21 ms, Memory: 4.00 MB
There was 1 warning:
1) Warning
No tests found in class "Tests\Functional\BaseTestCase".
WARNINGS!
Tests: 1, Assertions: 0, Warnings: 1.