Commit 338b3342 by Alexander Makarov

Improved console controller tests

parent 3c70d3c3
<?php
namespace yiiunit\extensions\mongodb\console\controllers;
use yii\mongodb\console\controllers\MigrateController;
/**
* MigrateController that writes output via echo instead of using output stream. Allows us to buffer it.
*/
class EchoMigrateController extends MigrateController
{
/**
* @inheritdoc
*/
public function stdout($string)
{
echo $string;
}
}
\ No newline at end of file
......@@ -8,7 +8,6 @@ use yii\mongodb\Query;
use Yii;
use yiiunit\extensions\mongodb\MongoDbTestCase;
use yiiunit\framework\console\controllers\MigrateControllerTestTrait;
use yii\mongodb\console\controllers\MigrateController;
/**
* Unit test for [[\yii\mongodb\console\controllers\MigrateController]].
......@@ -23,7 +22,7 @@ class MigrateControllerTest extends MongoDbTestCase
public function setUp()
{
$this->migrateControllerClass = MigrateController::className();
$this->migrateControllerClass = EchoMigrateController::className();
$this->migrationBaseClass = Migration::className();
parent::setUp();
......
......@@ -16,7 +16,7 @@ class CacheControllerTest extends TestCase
{
/**
* @var \yiiunit\framework\console\controllers\CacheConsoledController
* @var SilencedCacheController
*/
private $_cacheController;
......@@ -27,7 +27,7 @@ class CacheControllerTest extends TestCase
parent::setUp();
$this->_cacheController = Yii::createObject([
'class' => 'yiiunit\framework\console\controllers\CacheConsoledController',
'class' => 'yiiunit\framework\console\controllers\SilencedCacheController',
'interactive' => false,
],[null, null]); //id and module are null
......@@ -122,7 +122,7 @@ class CacheControllerTest extends TestCase
}
/**
* @expectedException yii\console\Exception
* @expectedException \yii\console\Exception
*/
public function testNothingToFlushException()
{
......@@ -141,12 +141,3 @@ class CacheControllerTest extends TestCase
}
}
class CacheConsoledController extends CacheController
{
public function stdout($string)
{
}
}
<?php
namespace yiiunit\framework\console\controllers;
use yii\console\controllers\MigrateController;
/**
* MigrateController that writes output via echo instead of using output stream. Allows us to buffer it.
*/
class EchoMigrateController extends MigrateController
{
/**
* @inheritdoc
*/
public function stdout($string)
{
echo $string;
}
}
\ No newline at end of file
......@@ -20,7 +20,7 @@ class MigrateControllerTest extends TestCase
public function setUp()
{
$this->migrateControllerClass = MigrateController::className();
$this->migrateControllerClass = EchoMigrateController::className();
$this->migrationBaseClass = Migration::className();
$this->mockApplication([
......
<?php
namespace yiiunit\framework\console\controllers;
use yii\console\controllers\CacheController;
/**
* CacheController that discards output.
*/
class SilencedCacheController extends CacheController
{
/**
* @inheritdoc
*/
public function stdout($string)
{
// do nothing
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment