mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-11-29 18:27:44 +08:00
Fixed Migration.
This commit is contained in:
parent
9a2a7768fa
commit
2eacea27fb
@ -1,5 +1,15 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://doc.hyperf.io
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
! defined('BASE_PATH') && define('BASE_PATH', __DIR__);
|
||||
|
||||
require_once BASE_PATH . '/vendor/autoload.php';
|
||||
require_once BASE_PATH . '/vendor/autoload.php';
|
||||
|
@ -45,7 +45,7 @@ class DatabaseMigrationResetCommandTest extends TestCase
|
||||
$migrator->shouldReceive('setConnection')->once()->with('default');
|
||||
$migrator->shouldReceive('repositoryExists')->once()->andReturn(true);
|
||||
$migrator->shouldReceive('setOutput')->once()->andReturn($migrator);
|
||||
$migrator->shouldReceive('reset')->once()->with([__DIR__ . DIRECTORY_SEPARATOR . 'migrations'], false);
|
||||
$migrator->shouldReceive('reset')->once()->with([BASE_PATH . DIRECTORY_SEPARATOR . 'migrations'], false);
|
||||
|
||||
$this->runCommand($command);
|
||||
}
|
||||
@ -57,7 +57,7 @@ class DatabaseMigrationResetCommandTest extends TestCase
|
||||
$migrator->shouldReceive('setConnection')->once()->with('foo');
|
||||
$migrator->shouldReceive('repositoryExists')->once()->andReturn(true);
|
||||
$migrator->shouldReceive('setOutput')->once()->andReturn($migrator);
|
||||
$migrator->shouldReceive('reset')->once()->with([__DIR__ . DIRECTORY_SEPARATOR . 'migrations'], true);
|
||||
$migrator->shouldReceive('reset')->once()->with([BASE_PATH . DIRECTORY_SEPARATOR . 'migrations'], true);
|
||||
|
||||
$this->runCommand($command, ['--pretend' => true, '--database' => 'foo']);
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ class DatabaseMigrationRollbackCommandTest extends TestCase
|
||||
$migrator->shouldReceive('paths')->once()->andReturn([]);
|
||||
$migrator->shouldReceive('setConnection')->once()->with('default');
|
||||
$migrator->shouldReceive('setOutput')->once()->andReturn($migrator);
|
||||
$migrator->shouldReceive('rollback')->once()->with([__DIR__ . DIRECTORY_SEPARATOR . 'migrations'], ['pretend' => false, 'step' => 0]);
|
||||
$migrator->shouldReceive('rollback')->once()->with([BASE_PATH . DIRECTORY_SEPARATOR . 'migrations'], ['pretend' => false, 'step' => 0]);
|
||||
|
||||
$this->runCommand($command);
|
||||
}
|
||||
@ -55,7 +55,7 @@ class DatabaseMigrationRollbackCommandTest extends TestCase
|
||||
$migrator->shouldReceive('paths')->once()->andReturn([]);
|
||||
$migrator->shouldReceive('setConnection')->once()->with('default');
|
||||
$migrator->shouldReceive('setOutput')->once()->andReturn($migrator);
|
||||
$migrator->shouldReceive('rollback')->once()->with([__DIR__ . DIRECTORY_SEPARATOR . 'migrations'], ['pretend' => false, 'step' => 2]);
|
||||
$migrator->shouldReceive('rollback')->once()->with([BASE_PATH . DIRECTORY_SEPARATOR . 'migrations'], ['pretend' => false, 'step' => 2]);
|
||||
|
||||
$this->runCommand($command, ['--step' => 2]);
|
||||
}
|
||||
@ -66,7 +66,7 @@ class DatabaseMigrationRollbackCommandTest extends TestCase
|
||||
$migrator->shouldReceive('paths')->once()->andReturn([]);
|
||||
$migrator->shouldReceive('setConnection')->once()->with('foo');
|
||||
$migrator->shouldReceive('setOutput')->once()->andReturn($migrator);
|
||||
$migrator->shouldReceive('rollback')->once()->with([__DIR__ . DIRECTORY_SEPARATOR . 'migrations'], true);
|
||||
$migrator->shouldReceive('rollback')->once()->with([BASE_PATH . DIRECTORY_SEPARATOR . 'migrations'], true);
|
||||
|
||||
$this->runCommand($command, ['--pretend' => true, '--database' => 'foo']);
|
||||
}
|
||||
@ -77,7 +77,7 @@ class DatabaseMigrationRollbackCommandTest extends TestCase
|
||||
$migrator->shouldReceive('paths')->once()->andReturn([]);
|
||||
$migrator->shouldReceive('setConnection')->once()->with('foo');
|
||||
$migrator->shouldReceive('setOutput')->once()->andReturn($migrator);
|
||||
$migrator->shouldReceive('rollback')->once()->with([__DIR__ . DIRECTORY_SEPARATOR . 'migrations'], ['pretend' => true, 'step' => 2]);
|
||||
$migrator->shouldReceive('rollback')->once()->with([BASE_PATH . DIRECTORY_SEPARATOR . 'migrations'], ['pretend' => true, 'step' => 2]);
|
||||
|
||||
$this->runCommand($command, ['--pretend' => true, '--database' => 'foo', '--step' => 2]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user