Laravel phpunit 跳过自定义测试文件
Laravel phpunit skipping custom test files
我已经使用命令
创建了一个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
在 Laravel 中,测试文件需要以 ..test.php 结尾。因此,将 EventUserRelations.php
更改为 EventUserRelationsTest.php
,它应该可以工作。
我已经使用命令
创建了一个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
在 Laravel 中,测试文件需要以 ..test.php 结尾。因此,将 EventUserRelations.php
更改为 EventUserRelationsTest.php
,它应该可以工作。