Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
338b3342
Commit
338b3342
authored
Nov 27, 2014
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved console controller tests
parent
3c70d3c3
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
64 additions
and
15 deletions
+64
-15
EchoMigrateController.php
...ons/mongodb/console/controllers/EchoMigrateController.php
+19
-0
MigrateControllerTest.php
...ons/mongodb/console/controllers/MigrateControllerTest.php
+1
-2
CacheControllerTest.php
...nit/framework/console/controllers/CacheControllerTest.php
+3
-12
EchoMigrateController.php
...t/framework/console/controllers/EchoMigrateController.php
+19
-0
MigrateControllerTest.php
...t/framework/console/controllers/MigrateControllerTest.php
+1
-1
SilencedCacheController.php
...framework/console/controllers/SilencedCacheController.php
+21
-0
No files found.
tests/unit/extensions/mongodb/console/controllers/EchoMigrateController.php
0 → 100644
View file @
338b3342
<?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
tests/unit/extensions/mongodb/console/controllers/MigrateControllerTest.php
View file @
338b3342
...
@@ -8,7 +8,6 @@ use yii\mongodb\Query;
...
@@ -8,7 +8,6 @@ use yii\mongodb\Query;
use
Yii
;
use
Yii
;
use
yiiunit\extensions\mongodb\MongoDbTestCase
;
use
yiiunit\extensions\mongodb\MongoDbTestCase
;
use
yiiunit\framework\console\controllers\MigrateControllerTestTrait
;
use
yiiunit\framework\console\controllers\MigrateControllerTestTrait
;
use
yii\mongodb\console\controllers\MigrateController
;
/**
/**
* Unit test for [[\yii\mongodb\console\controllers\MigrateController]].
* Unit test for [[\yii\mongodb\console\controllers\MigrateController]].
...
@@ -23,7 +22,7 @@ class MigrateControllerTest extends MongoDbTestCase
...
@@ -23,7 +22,7 @@ class MigrateControllerTest extends MongoDbTestCase
public
function
setUp
()
public
function
setUp
()
{
{
$this
->
migrateControllerClass
=
MigrateController
::
className
();
$this
->
migrateControllerClass
=
Echo
MigrateController
::
className
();
$this
->
migrationBaseClass
=
Migration
::
className
();
$this
->
migrationBaseClass
=
Migration
::
className
();
parent
::
setUp
();
parent
::
setUp
();
...
...
tests/unit/framework/console/controllers/CacheControllerTest.php
View file @
338b3342
...
@@ -16,7 +16,7 @@ class CacheControllerTest extends TestCase
...
@@ -16,7 +16,7 @@ class CacheControllerTest extends TestCase
{
{
/**
/**
* @var
\yiiunit\framework\console\controllers\CacheConsoled
Controller
* @var
SilencedCache
Controller
*/
*/
private
$_cacheController
;
private
$_cacheController
;
...
@@ -27,7 +27,7 @@ class CacheControllerTest extends TestCase
...
@@ -27,7 +27,7 @@ class CacheControllerTest extends TestCase
parent
::
setUp
();
parent
::
setUp
();
$this
->
_cacheController
=
Yii
::
createObject
([
$this
->
_cacheController
=
Yii
::
createObject
([
'class'
=>
'yiiunit\framework\console\controllers\
CacheConsoled
Controller'
,
'class'
=>
'yiiunit\framework\console\controllers\
SilencedCache
Controller'
,
'interactive'
=>
false
,
'interactive'
=>
false
,
],[
null
,
null
]);
//id and module are null
],[
null
,
null
]);
//id and module are null
...
@@ -122,7 +122,7 @@ class CacheControllerTest extends TestCase
...
@@ -122,7 +122,7 @@ class CacheControllerTest extends TestCase
}
}
/**
/**
* @expectedException yii\console\Exception
* @expectedException
\
yii\console\Exception
*/
*/
public
function
testNothingToFlushException
()
public
function
testNothingToFlushException
()
{
{
...
@@ -141,12 +141,3 @@ class CacheControllerTest extends TestCase
...
@@ -141,12 +141,3 @@ class CacheControllerTest extends TestCase
}
}
}
}
class
CacheConsoledController
extends
CacheController
{
public
function
stdout
(
$string
)
{
}
}
tests/unit/framework/console/controllers/EchoMigrateController.php
0 → 100644
View file @
338b3342
<?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
tests/unit/framework/console/controllers/MigrateControllerTest.php
View file @
338b3342
...
@@ -20,7 +20,7 @@ class MigrateControllerTest extends TestCase
...
@@ -20,7 +20,7 @@ class MigrateControllerTest extends TestCase
public
function
setUp
()
public
function
setUp
()
{
{
$this
->
migrateControllerClass
=
MigrateController
::
className
();
$this
->
migrateControllerClass
=
Echo
MigrateController
::
className
();
$this
->
migrationBaseClass
=
Migration
::
className
();
$this
->
migrationBaseClass
=
Migration
::
className
();
$this
->
mockApplication
([
$this
->
mockApplication
([
...
...
tests/unit/framework/console/controllers/SilencedCacheController.php
0 → 100644
View file @
338b3342
<?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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment