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
9e62d558
Commit
9e62d558
authored
Jul 28, 2014
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added unit test for #4489
parent
a7044c83
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
2 deletions
+22
-2
ManagerTestCase.php
tests/unit/framework/rbac/ManagerTestCase.php
+21
-0
PhpManagerTest.php
tests/unit/framework/rbac/PhpManagerTest.php
+1
-2
No files found.
tests/unit/framework/rbac/ManagerTestCase.php
View file @
9e62d558
...
...
@@ -4,6 +4,7 @@ namespace yiiunit\framework\rbac;
use
yii\rbac\Item
;
use
yii\rbac\Permission
;
use
yii\rbac\PhpManager
;
use
yii\rbac\Role
;
use
yiiunit\TestCase
;
...
...
@@ -268,4 +269,24 @@ abstract class ManagerTestCase extends TestCase
$this
->
assertContains
(
'reader'
,
$roleNames
,
'Roles should contain reader. Currently it has: '
.
implode
(
', '
,
$roleNames
));
$this
->
assertContains
(
'author'
,
$roleNames
,
'Roles should contain author. Currently it has: '
.
implode
(
', '
,
$roleNames
));
}
public
function
testAssignmentsToIntegerId
()
{
$this
->
prepareData
();
$reader
=
$this
->
auth
->
getRole
(
'reader'
);
$author
=
$this
->
auth
->
getRole
(
'author'
);
$this
->
auth
->
assign
(
$reader
,
42
);
$this
->
auth
->
assign
(
$author
,
1337
);
$this
->
auth
->
assign
(
$reader
,
1337
);
if
(
$this
->
auth
instanceof
PhpManager
)
{
$this
->
auth
->
save
();
}
$this
->
auth
=
$this
->
createManager
();
$this
->
assertEquals
(
0
,
count
(
$this
->
auth
->
getAssignments
(
0
)));
$this
->
assertEquals
(
1
,
count
(
$this
->
auth
->
getAssignments
(
42
)));
$this
->
assertEquals
(
2
,
count
(
$this
->
auth
->
getAssignments
(
1337
)));
}
}
tests/unit/framework/rbac/PhpManagerTest.php
View file @
9e62d558
...
...
@@ -76,4 +76,4 @@ class PhpManagerTest extends ManagerTestCase
$this
->
assertEquals
(
$assignments
,
$this
->
auth
->
assignments
);
$this
->
assertEquals
(
$rules
,
$this
->
auth
->
rules
);
}
}
\ 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