be($this->user()); $this->call('GET', '/attachment/delete/1'); $this->assertResponseStatus(200); } /** * @covers FireflyIII\Http\Controllers\AttachmentController::destroy */ public function testDestroy() { $this->be($this->user()); $this->session(['attachments.delete.url' => 'http://localhost']); $this->call('POST', '/attachment/destroy/2'); $this->assertResponseStatus(302); } /** * @covers FireflyIII\Http\Controllers\AttachmentController::download */ public function testDownload() { $this->be($this->user()); $this->call('GET', '/attachment/download/1'); $this->assertResponseStatus(200); // must have certain headers } /** * @covers FireflyIII\Http\Controllers\AttachmentController::edit */ public function testEdit() { $this->be($this->user()); $this->call('GET', '/attachment/edit/1'); $this->assertResponseStatus(200); } /** * @covers FireflyIII\Http\Controllers\AttachmentController::preview */ public function testPreview() { $this->be($this->user()); $this->call('GET', '/attachment/preview/1'); $this->assertResponseStatus(200); } /** * @covers FireflyIII\Http\Controllers\AttachmentController::update * @covers FireflyIII\Http\Requests\AttachmentFormRequest::authorize * @covers FireflyIII\Http\Requests\AttachmentFormRequest::rules */ public function testUpdate() { $this->session(['attachments.edit.url' => 'http://localhost']); $args = [ 'title' => 'New title', 'description' => 'New descr', 'notes' => 'New notes', ]; $this->be($this->user()); $this->call('POST', '/attachment/update/1', $args); $this->assertResponseStatus(302); $this->assertSessionHas('success'); } }