Laravel 9迁移(单位测试)
我正在使用Laravel 9应用程序,它没有迁移文件。 并且在编写测试用例时,我得到了服务器错误500,并且 pdoexception:sqlstate [hy000]:常规错误:1个这样的表:{table-name} in/vendor/laravel/framework/framework/src/illuminate/illuminate/database/database/connection.php:368
i创建了测试迁移文件并使用其路径运行,但不起作用,
class AppTest extends TestCase {
use DatabaseMigrations;
public function setUp(): void {
parent::setUp();
Artisan::call('migrate', ['--path' => base_path('tests/migrations/')]);
}
}
我如何在没有迁移文件的情况下测试该应用程序,还是还有另一种方法?
I'm working on a Laravel 9 app, it has no migration files.
And when writing test cases, I got server error 500 andPDOException: SQLSTATE[HY000]: General error: 1 no such table: {table-name} in /vendor/laravel/framework/src/Illuminate/Database/Connection.php:368
I created test migration files and run them with its path but does not work
class AppTest extends TestCase {
use DatabaseMigrations;
public function setUp(): void {
parent::setUp();
Artisan::call('migrate', ['--path' => base_path('tests/migrations/')]);
}
}
How can I test the app without migration files, or is there another way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论