【问题标题】:Laravel phpunit skipping custom test filesLaravel phpunit 跳过自定义测试文件
【发布时间】:2016-10-29 21:00:35
【问题描述】:

我已经使用命令创建了一个 laravel 测试文件

php artisan make:test EventUserRelations

当我运行 phpunit 时,就好像该文件甚至不存在一样。我试图让测试失败只是为了确保它正在被测试。这是文件中的代码:

class EventUserRelations extends TestCase
{
    public function testExample()
    {
        $this->fail();
    }
}

这是结果。

phpunit --debug

PHPUnit 5.4.6 by Sebastian Bergmann and contributors.


Starting test 'ExampleTest::testBasicExample'.
.                                                                   1 / 1 (100%)

Time: 119 ms, Memory: 20.75MB

【问题讨论】:

    标签: php laravel phpunit


    【解决方案1】:

    在 Laravel 中测试文件需要以 ..test.php 结尾。因此,将EventUserRelations.php 更改为EventUserRelationsTest.php,它应该可以工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-05-01
      • 2015-11-27
      • 2020-05-06
      • 2017-12-05
      • 2012-09-12
      • 1970-01-01
      • 2017-11-29
      相关资源
      最近更新 更多