Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
laravel-adminpanel
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
laravel-adminpanel
Commits
2a07f8ac
Commit
2a07f8ac
authored
Jan 02, 2018
by
Viral Solani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Feature Tests For Permission Module
parent
53183ef9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
0 deletions
+56
-0
PermissionFactory.php
database/factories/PermissionFactory.php
+13
-0
ManagePermissionsTest.php
tests/Feature/Backend/ManagePermissionsTest.php
+43
-0
No files found.
database/factories/PermissionFactory.php
View file @
2a07f8ac
...
...
@@ -16,3 +16,16 @@ $factory->define(Permission::class, function (Generator $faker) {
'sort'
=>
$faker
->
numberBetween
(
1
,
100
),
];
});
$factory
->
state
(
Permission
::
class
,
'active'
,
function
()
{
return
[
'status'
=>
1
,
];
});
$factory
->
state
(
Permission
::
class
,
'inactive'
,
function
()
{
return
[
'status'
=>
0
,
];
});
\ No newline at end of file
tests/Feature/Backend/ManagePermissionsTest.php
0 → 100644
View file @
2a07f8ac
<?php
namespace
Tests\Feature\Backend
;
use
App\Models\Access\Permission\Permission
;
use
Illuminate\Support\Facades\Event
;
use
Tests\TestCase
;
class
ManagePermissionsTest
extends
TestCase
{
/** @test */
public
function
a_user_can_view_permissions
()
{
$this
->
actingAs
(
$this
->
admin
)
->
get
(
route
(
'admin.access.permission.index'
))
->
assertViewIs
(
'backend.access.permissions.index'
)
->
assertSee
(
trans
(
'labels.backend.access.permissions.management'
))
->
assertSee
(
'Export'
)
->
assertSee
(
'Action'
);
}
/** @test */
public
function
a_permission_requires_a_name
()
{
$permission
=
make
(
Permission
::
class
,
[
'name'
=>
null
])
->
toArray
();
return
$this
->
withExceptionHandling
()
->
actingAs
(
$this
->
admin
)
->
post
(
route
(
'admin.access.permission.store'
),
$permission
)
->
assertSessionHasErrors
(
'name'
);
}
/** @test */
public
function
a_permission_requires_a_display_name
()
{
$permission
=
make
(
Permission
::
class
,
[
'display_name'
=>
null
])
->
toArray
();
return
$this
->
withExceptionHandling
()
->
actingAs
(
$this
->
admin
)
->
post
(
route
(
'admin.access.permission.store'
),
$permission
)
->
assertSessionHasErrors
(
'display_name'
);
}
}
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