-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathAdminMenuTest.php
59 lines (50 loc) · 1.9 KB
/
AdminMenuTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
namespace Modules\MyBlog\Tests\Feature;
use App\Traits\Permissions;
use Tests\Feature\FeatureTestCase;
class AdminMenuTest extends FeatureTestCase
{
use Permissions;
public function testItShouldSeeAdminPostsMenuItem()
{
$this->loginAs()
->get(route('dashboard'))
->assertOk()
->assertSeeInOrder([
'<li class="group relative pb-2.5">',
'<a class="flex items-center text-purple" href="' . route('my-blog.posts.index') . '">',
'<span class="text-sm ltr:ml-2 rtl:mr-2">' . trans_choice('my-blog::general.posts', 2) . '</span>',
], false);
}
public function testItShouldNotSeeAdminPostsMenuItem()
{
$this->detachPermissionsFromAdminRoles([
'my-blog-posts' => 'r',
]);
$this->loginAs()
->get(route('dashboard'))
->assertOk()
->assertDontSee('<a class="flex items-center text-purple" href="' . route('my-blog.posts.index') . '">', false);
}
public function testItShouldSeeAdminCommentsMenuItem()
{
$this->loginAs()
->get(route('dashboard'))
->assertOk()
->assertSeeInOrder([
'<li class="group relative pb-2.5">',
'<a class="flex items-center text-purple" href="' . route('my-blog.comments.index') . '">',
'<span class="text-sm ltr:ml-2 rtl:mr-2">' . trans_choice('my-blog::general.comments', 2) . '</span>',
], false);
}
public function testItShouldNotSeeAdminCommentsMenuItem()
{
$this->detachPermissionsFromAdminRoles([
'my-blog-comments' => 'r',
]);
$this->loginAs()
->get(route('dashboard'))
->assertOk()
->assertDontSee('<a class="flex items-center text-purple" href="' . route('my-blog.comments.index') . '">', false);
}
}