/** * @test */ public function it_allows_destroy_entry() { $adminUser = User::first(); $this->actingAs($adminUser); $this->it_allows_create_entry(); // get index url /** @var CrudContract $controller */ $controller = $this->getControllerClass(); $urlBuilder = new UrlBuilder($controller, $this->getUrlParameters()); /** @var Model $model */ $model = $controller->getModelClass(); // get last item $emptyModel = new $model(); $columnId = $emptyModel->getKeyName(); $lastEntry = $model::orderBy($columnId, 'desc')->first(); $url = $urlBuilder->getUrlDestroy($lastEntry->getKey()); // check $this->delete($url, ['_token' => csrf_token()])->see('Redirecting'); }
/** * @test */ public function it_allows_create_entry_with_gif_file() { $adminUser = User::first(); $this->actingAs($adminUser); $controller = $this->getControllerClass(); // get create url $urlBuilder = new UrlBuilder($controller, $this->getUrlParameters()); $url = $urlBuilder->getUrlCreate(); // call $this->visit($url); // fill the form $this->type($this->gifFilepath, 'file'); // check $this->press($this->getCreateButtonText())->see('alert-success'); }