mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-15 06:40:59 +08:00
53 lines
1.1 KiB
PHP
53 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace yiiunit\framework\console\controllers;
|
|
|
|
use Yii;
|
|
use yii\console\controllers\MigrateController;
|
|
use yii\db\Migration;
|
|
use yii\db\Query;
|
|
use yiiunit\TestCase;
|
|
|
|
/**
|
|
* Unit test for [[\yii\console\controllers\MigrateController]].
|
|
* @see MigrateController
|
|
*
|
|
* @group console
|
|
*/
|
|
class MigrateControllerTest extends TestCase
|
|
{
|
|
use MigrateControllerTestTrait;
|
|
|
|
public function setUp()
|
|
{
|
|
$this->migrateControllerClass = EchoMigrateController::className();
|
|
$this->migrationBaseClass = Migration::className();
|
|
|
|
$this->mockApplication([
|
|
'components' => [
|
|
'db' => [
|
|
'class' => 'yii\db\Connection',
|
|
'dsn' => 'sqlite::memory:',
|
|
],
|
|
],
|
|
]);
|
|
|
|
$this->setUpMigrationPath();
|
|
parent::setUp();
|
|
}
|
|
|
|
public function tearDown()
|
|
{
|
|
$this->tearDownMigrationPath();
|
|
parent::tearDown();
|
|
}
|
|
|
|
/**
|
|
* @return array applied migration entries
|
|
*/
|
|
protected function getMigrationHistory()
|
|
{
|
|
$query = new Query();
|
|
return $query->from('migration')->all();
|
|
}
|
|
} |