Expand tests.

This commit is contained in:
James Cole
2017-03-19 17:54:21 +01:00
parent 1adb0f2f0e
commit 9515ce6807
25 changed files with 1180 additions and 551 deletions

View File

@@ -48,6 +48,24 @@ class ExportControllerTest extends TestCase
$response->assertStatus(200);
}
/**
* @covers \FireflyIII\Http\Controllers\ExportController::download
* @expectedExceptionMessage Against all expectations
*/
public function testDownloadFailed()
{
// mock stuff
$repository = $this->mock(ExportJobRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('exists')->once()->andReturn(false);
$this->be($this->user());
$response = $this->get(route('export.download', ['testExport']));
$response->assertStatus(500);
}
/**
* @covers \FireflyIII\Http\Controllers\ExportController::getStatus
*/
@@ -103,11 +121,13 @@ class ExportControllerTest extends TestCase
$data = [
'export_start_range' => '2015-01-01',
'export_end_range' => '2015-01-21',
'exportFormat' => 'csv',
'accounts' => [1],
'job' => 'testExport',
'export_start_range' => '2015-01-01',
'export_end_range' => '2015-01-21',
'exportFormat' => 'csv',
'accounts' => [1],
'include_attachments' => '1',
'include_old_uploads' => '1',
'job' => 'testExport',
];
$accountRepos->shouldReceive('getAccountsById')->withArgs([$data['accounts']])->andReturn(new Collection);
@@ -117,6 +137,8 @@ class ExportControllerTest extends TestCase
$processor->shouldReceive('convertJournals')->once();
$processor->shouldReceive('exportJournals')->once();
$processor->shouldReceive('createZipFile')->once();
$processor->shouldReceive('collectOldUploads')->once();
$processor->shouldReceive('collectAttachments')->once();
$repository->shouldReceive('changeStatus')->andReturn(true);
$repository->shouldReceive('findByKey')->andReturn(new ExportJob);