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.
|
|
<?php
namespace Tests\Feature\Collection;
use App\Models\Collection; use App\Documents\UserDocument; use Tests\Bootstrap; use Illuminate\Support\Arr;
class CollectionStoreTest extends Bootstrap { public function test_collection_store_success() { $this->modelWithPolicy('collections', ['permission:collections.store']) ->loginAs(['collections.store']) ->postJson(route('api.collections.store'), $collection = $this->make(Collection::class)) ->assertCreated(); }
/** * @testWith * ["name:gtString"] * ["name:numeric"] * ["name:null"] * ["path:gtString"] * ["path:numeric"] * ["public:string"] * ["disk:numeric"] * ["disk:null"] * ["disk:gtString"] * ["count:null"] * ["count:string"] * ["count:gt:100000"] * */ public function test_collection_store_unprocessable($field) { $this->modelWithPolicy('collections', ['permission:collections.store']) ->loginAsAdmin() ->postJson(route("api.collections.store"), $collection = $this->make(collection::class, smash: $field, withDependency: true)) ->assertUnprocessable(); }
public function test_collection_store_forbidden() { $this->modelWithPolicy('collections', ['permission:collections.store']) ->loginAs(['wrong.permission']) ->postJson(route("api.collections.store"), []) ->assertForbidden(); } }
|