Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Administrator
Platform
Commits
c0c50cef
Commit
c0c50cef
authored
Sep 26, 2014
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moving the permission manager test to core module
parent
d569704a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
85 deletions
+0
-85
PermissionManagerTest.php
Tests/PermissionManagerTest.php
+0
-85
No files found.
Tests/PermissionManagerTest.php
deleted
100644 → 0
View file @
d569704a
<?php
namespace
Modules\User\Tests
;
use
Mockery
;
use
Modules\Core\Permissions\PermissionManager
;
class
PermissionManagerTest
extends
\TestCase
{
/**
* @var PermissionManager
*/
protected
$permissions
;
public
function
setUp
()
{
parent
::
setUp
();
$enabledModules
=
[
'Session'
,
'User'
,
'Dashboard'
,
'Core'
];
$moduleMock
=
Mockery
::
mock
(
'Pingpong\Modules\Module'
);
$moduleMock
->
shouldReceive
(
'enabled'
)
->
once
()
->
andReturn
(
$enabledModules
);
$this
->
permissions
=
new
PermissionManager
(
$moduleMock
);
}
/** @test */
public
function
itShouldReturnAllPermissions
()
{
$expected
=
[
'Dashboard'
=>
[
'dashboard'
=>
[
'index'
]
],
'User'
=>
[
'users'
=>
[
'index'
,
'create'
,
'store'
,
'edit'
,
'update'
,
'destroy'
],
'roles'
=>
[
'index'
,
'create'
,
'store'
,
'edit'
,
'update'
,
'destroy'
]
],
];
$permissions
=
$this
->
permissions
->
all
();
$this
->
assertEquals
(
$expected
,
$permissions
);
}
/** @test */
public
function
itShouldCleanPermissionsCorrectlyTypeCasted
()
{
$requestData
=
[
'dashboard.index'
=>
'true'
,
'users.index'
=>
'true'
,
'users.create'
=>
'true'
,
'users.edit'
=>
'true'
,
'users.delete'
=>
'true'
,
'roles.create'
=>
'true'
,
];
$expected
=
[
'dashboard.index'
=>
true
,
'users.index'
=>
true
,
'users.create'
=>
true
,
'users.edit'
=>
true
,
'users.delete'
=>
true
,
'roles.create'
=>
true
,
];
$cleanedPermissions
=
$this
->
permissions
->
clean
(
$requestData
);
$this
->
assertEquals
(
$expected
,
$cleanedPermissions
);
}
}
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