You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
681 B
25 lines
681 B
<?php
|
|
|
|
namespace Tests\iLaravel\Policies;
|
|
|
|
use App\Models\ILaravel;
|
|
use Tests\Bootstrap;
|
|
|
|
class PermissionPolicyTest extends Bootstrap
|
|
{
|
|
function test_permission_policy_successful()
|
|
{
|
|
$this->modelWithPolicy('ilaravels', ['permission:show'])
|
|
->loginAs(['show'])
|
|
->getJson(route('api.ilaravels.show', $this->one(ILaravel::class)))
|
|
->assertOk();
|
|
}
|
|
|
|
function test_permission_policy_fail()
|
|
{
|
|
$this->modelWithPolicy('ilaravels', ['permission:show'])
|
|
->loginAs(['wrong.permission'])
|
|
->getJson(route('api.ilaravels.show', $this->one(ILaravel::class)))
|
|
->assertForbidden();
|
|
}
|
|
}
|