Code cleanup for #595

This commit is contained in:
James Cole
2017-03-18 11:02:02 +01:00
parent 3215c4ee4b
commit 282ce041e1
14 changed files with 187 additions and 164 deletions

View File

@@ -71,6 +71,24 @@ class AttachmentControllerTest extends TestCase
$response->assertSee('This is attachment number one.');
}
/**
* @covers \FireflyIII\Http\Controllers\AttachmentController::download
* @expectedExceptionMessage Could not find the indicated attachment
*/
public function testDownloadFail()
{
// mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(AttachmentRepositoryInterface::class);
$repository->shouldReceive('exists')->once()->andReturn(false);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$this->be($this->user());
$response = $this->get(route('attachments.download', [1]));
$response->assertStatus(500);
}
/**
* @covers \FireflyIII\Http\Controllers\AttachmentController::edit
*/
@@ -94,7 +112,7 @@ class AttachmentControllerTest extends TestCase
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$this->be($this->user());
$response = $this->get(route('attachments.preview', [1]));
$response = $this->get(route('attachments.preview', [3]));
$response->assertStatus(200);
}