gpt4 book ai didi

php - 在 phpunit 中运行一个文件或 map

转载 作者:可可西里 更新时间:2023-10-31 22:18:40 26 4
gpt4 key购买 nike

我正在使用 laravel 并且我已经编写了一些测试文件。但是我怎样才能只执行一个文件呢?例如,当我这样做时:phpunit tests/resulttesting/school/deleteSchoolForRealTest 它抛出一个错误:

Cannot open file "tests/resulttesting/school/deleteSchoolForRealTest.php".

当我运行 phpunit 时,它会运行我所有的测试。我怎样才能只执行一个文件夹?我在 Mac 上。

最佳答案

你做的一切都是正确的。

1)

第一种添加文件夹的方法。我的正确方法是:

phpunit tests/EWalletTest

当我忘记从“测试”文件夹开始时,我遇到了同样的错误

phpunit EWalletTest

我得到了

Cannot open file "EWalletTest.php".

2)

过滤器 是另一种选择。 read here示例:

phpunit --filter EWallet

Only runs tests whose name matches the given regular expression pattern.

这意味着您将执行文件 EWalletTestEWalletFooTest 以及来自其他文件的测试用例,名称如 `test_EWallet_with_Australian_dollar。

关于php - 在 phpunit 中运行一个文件或 map ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35596637/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com