3 回答

TA貢獻(xiàn)1898條經(jīng)驗 獲得超8個贊
在您的 phpunit.xml 中,將 suffix 屬性添加到標(biāo)簽中。該示例將運行所有.php文件,如果您在那里沒有任何 TestCase 類/文件,這可能會變得有風(fēng)險,這就是為什么它的約定使用Test.
<testsuite name="Feature">
<directory suffix=".php">./tests/Feature</directory>
</testsuite>
希望這可以幫助!

TA貢獻(xiàn)2016條經(jīng)驗 獲得超9個贊
它不讀取類級別的/** @test */注釋,但默認(rèn)的 phpunit.xml 文件也具有使用文件名后綴定義的測試套件:
<testsuites>
<testsuite name="default">
<directory suffix="Test.php">tests</directory>
</testsuite>
</testsuites>
如果您在特定文件上運行 phpunit:vendor/bin/phpunit tests/RepoPost.php它會運行測試,即使文件名與后綴不匹配。

TA貢獻(xiàn)1831條經(jīng)驗 獲得超4個贊
您可以使用后綴:
<testsuite name="Feature"> <directory suffix="Test.php">./tests/Feature</directory> </testsuite>
然后你應(yīng)該將你的文件重命名為 RepoPostTest.php
- 3 回答
- 0 關(guān)注
- 148 瀏覽
添加回答
舉報