phpunit - “”目录不存在 - Laravel 7 + PhpUnit
问题描述
我开始测试 laravel 7 应用程序。我创建了一个简单的测试:
namespace Tests\Unit;
use Tests\TestCase;
class LoginTest extends TestCase
{
/** @test */
public function user_login() {
$response = $this->get('/');
$response->assertStatus(200);
}
}
但是,当我运行时vendor/bin/phpunit
,我收到此错误:
1) Tests\Feature\LoginTest::user_login Symfony\Component\Finder\Exception\DirectoryNotFoundException: The "" 目录不存在。
当我改变这条线
use Tests\TestCase;
至
use PHPUnit\Framework\TestCase;
我得到一个不同的错误:
1) Tests\Unit\LoginTest::user_login 错误:调用未定义的方法 Tests\Unit\LoginTest::get()
我做错了什么?有人可以帮我弄清楚吗?
非常感谢。
解决方案
推荐阅读
- c# - 如何在剃刀页面的属性内转义引号
- angular - 在离开网页之前警告用户未保存的更改角度
- c# - 我的 ASP.NET MVC 应用程序中的 Quartz 调度程序仅在 IIS 服务器上刷新网页/应用程序后才执行作业
- c# - 如何在 Xamarin Form 项目中获取 XAML 文件中描述的控件?
- regex - 匹配一行中的第 n 个单词
- sql - 有没有办法让这个查询成为一个循环或更有效?
- python - 使用分类变量运行 F 检验
- python - 将 pageToken 与 Google Analytics Reporting API v4 和 Python 结合使用
- verilog - 总是敏感列表中的异或。Verilog
- react-native - 执行失败:react-native-fbsdk:compileReleaseJavaWithJavac'