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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Rotua Panjaitan
yii2
Commits
5046e687
Commit
5046e687
authored
Aug 05, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed random rbac testing failure.
parent
3b3fb18f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
2 deletions
+14
-2
PhpManagerTest.php
tests/unit/framework/rbac/PhpManagerTest.php
+14
-2
No files found.
tests/unit/framework/rbac/PhpManagerTest.php
View file @
5046e687
...
...
@@ -11,6 +11,15 @@ function filemtime($file)
return
\yiiunit\framework\rbac\PhpManagerTest
::
$filemtime
?:
\filemtime
(
$file
);
}
/**
* Mock for the time() function for rbac classes. Avoid random test fails.
* @return int
*/
function
time
()
{
return
\yiiunit\framework\rbac\PhpManagerTest
::
$time
?:
\time
();
}
namespace
yiiunit\framework\rbac
;
use
Yii
;
...
...
@@ -22,6 +31,7 @@ use Yii;
class
PhpManagerTest
extends
ManagerTestCase
{
public
static
$filemtime
;
public
static
$time
;
protected
function
getItemFile
()
{
...
...
@@ -60,6 +70,7 @@ class PhpManagerTest extends ManagerTestCase
protected
function
setUp
()
{
static
::
$filemtime
=
null
;
static
::
$time
=
null
;
parent
::
setUp
();
$this
->
mockApplication
();
$this
->
removeDataFiles
();
...
...
@@ -70,18 +81,19 @@ class PhpManagerTest extends ManagerTestCase
{
$this
->
removeDataFiles
();
static
::
$filemtime
=
null
;
static
::
$time
=
null
;
parent
::
tearDown
();
}
public
function
testSaveLoad
()
{
$this
->
prepareData
();
static
::
$time
=
static
::
$filemtime
=
\time
();
$this
->
prepareData
();
$items
=
$this
->
auth
->
items
;
$children
=
$this
->
auth
->
children
;
$assignments
=
$this
->
auth
->
assignments
;
$rules
=
$this
->
auth
->
rules
;
static
::
$filemtime
=
time
();
$this
->
auth
->
save
();
$this
->
auth
=
$this
->
createManager
();
...
...
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