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
f11d6089
Commit
f11d6089
authored
May 07, 2014
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Re-init application if it was destroyed during RBAC test
parent
3af22ece
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
12 deletions
+19
-12
DbManagerTestCase.php
tests/unit/framework/rbac/DbManagerTestCase.php
+19
-12
No files found.
tests/unit/framework/rbac/DbManagerTestCase.php
View file @
f11d6089
<?php
<?php
namespace
yiiunit\framework\rbac
;
namespace
yiiunit\framework\rbac
;
use
Yii
;
use
yii\console\Application
;
use
yii\console\Application
;
use
yii\console\controllers\MigrateController
;
use
yii\console\controllers\MigrateController
;
use
yii\db\Connection
;
use
yii\db\Connection
;
...
@@ -19,6 +20,21 @@ abstract class DbManagerTestCase extends ManagerTestCase
...
@@ -19,6 +20,21 @@ abstract class DbManagerTestCase extends ManagerTestCase
*/
*/
protected
static
$db
;
protected
static
$db
;
public
static
function
getApplication
()
{
if
(
Yii
::
$app
===
null
)
{
new
Application
([
'id'
=>
'Migrator'
,
'basePath'
=>
'@yiiunit'
,
'components'
=>
[
'db'
=>
static
::
getConnection
(),
'authManager'
=>
'\yii\rbac\DbManager'
,
],
]);
}
return
Yii
::
$app
;
}
public
static
function
setUpBeforeClass
()
public
static
function
setUpBeforeClass
()
{
{
parent
::
setUpBeforeClass
();
parent
::
setUpBeforeClass
();
...
@@ -30,25 +46,16 @@ abstract class DbManagerTestCase extends ManagerTestCase
...
@@ -30,25 +46,16 @@ abstract class DbManagerTestCase extends ManagerTestCase
static
::
markTestSkipped
(
'pdo and '
.
$pdo_database
.
' extension are required.'
);
static
::
markTestSkipped
(
'pdo and '
.
$pdo_database
.
' extension are required.'
);
}
}
new
Application
([
static
::
getApplication
()
->
runAction
(
'migrate/up'
,
[
'migrationPath'
=>
'@yii/rbac/migrations/'
,
'interactive'
=>
false
]);
'id'
=>
'Migrator'
,
'basePath'
=>
'@yiiunit'
,
'components'
=>
[
'db'
=>
static
::
getConnection
(),
'authManager'
=>
'\yii\rbac\DbManager'
,
],
]);
\Yii
::
$app
->
runAction
(
'migrate/up'
,
[
'migrationPath'
=>
'@yii/rbac/migrations/'
,
'interactive'
=>
false
]);
}
}
public
static
function
tearDownAfterClass
()
public
static
function
tearDownAfterClass
()
{
{
\Yii
::
$app
->
runAction
(
'migrate/down'
,
[
'migrationPath'
=>
'@yii/rbac/migrations/'
,
'interactive'
=>
false
]);
static
::
getApplication
()
->
runAction
(
'migrate/down'
,
[
'migrationPath'
=>
'@yii/rbac/migrations/'
,
'interactive'
=>
false
]);
if
(
static
::
$db
)
{
if
(
static
::
$db
)
{
static
::
$db
->
close
();
static
::
$db
->
close
();
}
}
\
Yii
::
$app
=
null
;
Yii
::
$app
=
null
;
parent
::
tearDownAfterClass
();
parent
::
tearDownAfterClass
();
}
}
...
...
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