Php 拉韦尔敦的移民';测试时不能正常工作
我在进行测试时遇到了运行迁移的问题。我在不同的地方迁移。用户迁移取决于公司迁移,但每次运行测试时都会出现一个错误,即表“companys”不存在 来自测试类的代码:Php 拉韦尔敦的移民';测试时不能正常工作,php,laravel,unit-testing,phpunit,migration,Php,Laravel,Unit Testing,Phpunit,Migration,我在进行测试时遇到了运行迁移的问题。我在不同的地方迁移。用户迁移取决于公司迁移,但每次运行测试时都会出现一个错误,即表“companys”不存在 来自测试类的代码: protected function setUp() { parent::setUp(); $this->artisan('migrate', [ '--path' => ['Modules/Company/Database/Migrations',
protected function setUp()
{
parent::setUp();
$this->artisan('migrate', [
'--path' => ['Modules/Company/Database/Migrations',
'Modules/User/Database/Migrations'],
]);
}
protected function tearDown()
{
$this->artisan('migrate:reset', [
'--path' => ['Modules/User/Database/Migrations',
'Modules/Company/Database/Migrations'],
]);
parent::tearDown();
}
谁能帮帮我吗。
谢谢 问题出在两个地方:
- 1) 选项--路径作为数组提供(但不显示任何警告)李>
- 2) 命令migrate:reset(它使用提供的--path重置所有迁移,从而发生错误“Undefined index:create_company_table”)
protected function setUp()
{
parent::setUp();
$this->artisan('migrate', [
'--path' => 'Modules/Company/Database/Migrations',
]);
$this->artisan('migrate', [
'--path' => 'Modules/User/Database/Migrations',
]);
}
protected function tearDown()
{
$this->artisan('migrate:rollback', [
'--path' => 'Modules/User/Database/Migrations/',
]);
$this->artisan('migrate:rollback', [
'--path' => 'Modules/Company/Database/Migrations/',
]);
parent::tearDown();
}