如何使用 phpunit --testsuite 选项?

How to use phpunit --testsuite option?

如何使用 phpunit --testsuite 命令?

比如我有一个测试文件:

test/xxx/RegistrationConfirmedListenerTest.php

如果我 运行 phpunit,那么它将 运行 RegistrationConfirmedListenerTest.php 中的测试,但它也会 运行 我的测试文件夹中的所有其他测试。

我试过像这样使用 --testsuite 选项:

phpunit --testsuite RegistrationConfirmedListenerTest

然而,运行什么都没有。

PHPUnit 4.8.26 by Sebastian Bergmann and contributors.



Time: 46 ms, Memory: 4.00Mb

No tests executed!

我已阅读此处的文档,但没有任何示例可以提供帮助:

https://phpunit.de/manual/current/en/textui.html

您必须创建一个 phpunit.xml 并在那里定义您的测试套件。

<testsuites>
    <testsuite name="youttestsuitename1">
        <file>./path/to/folder/</file>
    </testsuite>
    <testsuite name="youttestsuitename1">
        <file>./path/to/folder2/</file>
    </testsuite>
</testsuites> 

更多信息official documentations