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.
 
 
 
 

34 lines
1.0 KiB

<?php
namespace Tests\Feature\Collection;
use App\Models\Collection;
use Tests\Bootstrap;
use App\Models\User;
class CollectionShowTest extends Bootstrap
{
public function test_collection_show_success()
{
$this->modelWithPolicy('collections', ['permission:collections.show'])
->loginAs(['collections.show'])
->getJson(route("api.collections.show", $collection = $this->one(Collection::class)))
->assertOk();
}
public function test_collection_show_not_found()
{
$this->modelWithPolicy('collections', ['permission:collections.show'])
->loginAs(['collections.show'])
->getJson(route("api.collections.show", 0))
->assertNotFound();
}
public function test_collection_show_forbidden()
{
$this->modelWithPolicy('collections', ['permission:collections.show'])
->loginAs(['wrong.permission'])
->getJson(route("api.collections.show", $collection = $this->one(Collection::class)), [])
->assertForbidden();
}
}