Browse Source

DbSessionTest::testMigration() does not display migration process anymore (insted of 8de6fde)

tags/2.0.8
SilverFire - Dmitry Naumenko 9 years ago
parent
commit
813d1d9c31
  1. 8
      tests/framework/web/DbSessionTest.php
  2. 34
      tests/framework/web/mocks/ConsoleMock.php

8
tests/framework/web/DbSessionTest.php

@ -6,6 +6,7 @@ use Yii;
use yii\db\Connection;
use yii\db\Query;
use yii\web\DbSession;
use yiiunit\framework\console\controllers\EchoMigrateController;
use yiiunit\TestCase;
/**
@ -95,7 +96,7 @@ class DbSessionTest extends TestCase
protected function runMigrate($action, $params = [])
{
$migrate = new \yii\console\controllers\MigrateController('migrate', Yii::$app, [
$migrate = new EchoMigrateController('migrate', Yii::$app, [
'migrationPath' => '@yii/web/migrations',
'interactive' => false,
]);
@ -121,9 +122,6 @@ class DbSessionTest extends TestCase
],
]);
$consoleClass = Yii::$classMap['yii\helpers\Console'];
Yii::$classMap['yii\helpers\Console'] = Yii::getAlias('@yiiunit/framework/web/mocks/ConsoleMock.php');
$history = $this->runMigrate('history');
$this->assertEquals(['base'], $history);
@ -132,7 +130,5 @@ class DbSessionTest extends TestCase
$history = $this->runMigrate('down');
$this->assertEquals(['base'], $history);
Yii::$classMap['yii\helpers\Console'] = $consoleClass;
}
}

34
tests/framework/web/mocks/ConsoleMock.php

@ -1,34 +0,0 @@
<?php
namespace yii\helpers;
/**
* Mock of Console class
* @package yii\helpers
*/
class Console extends BaseConsole
{
/**
* Prints a string to output buffer instead of STOUT
*
* @param string $string the string to print
* @return integer|boolean Number of bytes printed or false on error
*/
public static function stdout($string)
{
echo $string;
return mb_strlen($string);
}
/**
* Prints a string to output buffer instead of STDERR
*
* @param string $string the string to print
* @return integer|boolean Number of bytes printed or false on error
*/
public static function stderr($string)
{
echo $string;
return mb_strlen($string);
}
}
Loading…
Cancel
Save