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.
29 lines
722 B
29 lines
722 B
<?php
|
|
|
|
|
|
namespace Tests\iLaravel\Policies;
|
|
|
|
|
|
use App\Documents\UserDocument;
|
|
use App\Models\ILaravel;
|
|
use Tests\Bootstrap;
|
|
|
|
class OwnerPolicyTest extends Bootstrap
|
|
{
|
|
function test_owner_policy_successful()
|
|
{
|
|
$this->modelWithPolicy('ilaravels', ['owner'])
|
|
->loginAs([], $user = $this->one(UserDocument::class))
|
|
->getJson(route('api.ilaravels.show', $this->one(ILaravel::class, ['user_id' => $user->id])))
|
|
->assertOk();
|
|
}
|
|
|
|
function test_owner_policy_fail()
|
|
{
|
|
$this->modelWithPolicy('ilaravels', ['owner'])
|
|
->loginAs()
|
|
->getJson(route('api.ilaravels.show', $this->one(ILaravel::class)))
|
|
->assertForbidden();
|
|
}
|
|
|
|
}
|