From 8de6fde9899f25b22de3673dc312010ffd373d42 Mon Sep 17 00:00:00 2001 From: SilverFire - Dmitry Naumenko Date: Mon, 25 Apr 2016 11:17:43 +0300 Subject: [PATCH] Added Console helper mock, updated DbSessionTest::testMigration() to hide migration process output --- tests/framework/web/DbSessionTest.php | 7 ++++- tests/framework/web/mocks/ConsoleMock.php | 34 +++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 tests/framework/web/mocks/ConsoleMock.php diff --git a/tests/framework/web/DbSessionTest.php b/tests/framework/web/DbSessionTest.php index 61a6b8fa9f..1c5f77d7d9 100644 --- a/tests/framework/web/DbSessionTest.php +++ b/tests/framework/web/DbSessionTest.php @@ -120,7 +120,10 @@ 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); @@ -129,5 +132,7 @@ class DbSessionTest extends TestCase $history = $this->runMigrate('down'); $this->assertEquals(['base'], $history); + + Yii::$classMap['yii\helpers\Console'] = $consoleClass; } } diff --git a/tests/framework/web/mocks/ConsoleMock.php b/tests/framework/web/mocks/ConsoleMock.php new file mode 100644 index 0000000000..22592c4a28 --- /dev/null +++ b/tests/framework/web/mocks/ConsoleMock.php @@ -0,0 +1,34 @@ +