Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Fix export controller tests.
James Cole7c5bed2bb593
diff --git a/app/Repositories/ExportJob/ExportJobRepository.php b/app/Repositories/ExportJob/ExportJobRepository.phpindex 66458230ec..b83818284a 100644--- a/app/Repositories/ExportJob/ExportJobRepository.php+++ b/app/Repositories/ExportJob/ExportJobRepository.php@@ -124,7 +124,7 @@ class ExportJobRepository implements ExportJobRepositoryInterface/*** @param string $key*- * @return ExportJob|null+ * @return ExportJob*/public function findByKey(string $key): ExportJob{diff --git a/tests/acceptance/Controllers/ExportControllerTest.php b/tests/acceptance/Controllers/ExportControllerTest.phpindex f0eb8d5716..39a7bd4ebc 100644--- a/tests/acceptance/Controllers/ExportControllerTest.php+++ b/tests/acceptance/Controllers/ExportControllerTest.php@@ -8,9 +8,13 @@** See the LICENSE file for details.*/+use Carbon\Carbon;use FireflyIII\Export\Processor;+use FireflyIII\Export\ProcessorInterface;use FireflyIII\Models\ExportJob;+use FireflyIII\Repositories\Account\AccountRepositoryInterface;use FireflyIII\Repositories\ExportJob\ExportJobRepositoryInterface;+use Illuminate\Support\Collection;/*** Generated by PHPUnit_SkeletonGenerator on 2016-12-10 at 05:51:41.@@ -70,6 +74,11 @@ class ExportControllerTest extends TestCase*/public function testPostIndex(){+ $this->session(+ ['first' => new Carbon('2014-01-01')]+ );++$data = ['export_start_range' => '2015-01-01',@@ -78,7 +87,11 @@ class ExportControllerTest extends TestCase'accounts' => [1],'job' => 'testExport',];- $processor = $this->mock(Processor::class);++ $accountRepository = $this->mock(AccountRepositoryInterface::class);+ $accountRepository->shouldReceive('getAccountsById')->withArgs([$data['accounts']])->andReturn(new Collection);++ $processor = $this->mock(ProcessorInterface::class);$processor->shouldReceive('collectJournals')->once();$processor->shouldReceive('convertJournals')->once();$processor->shouldReceive('exportJournals')->once();@@ -88,8 +101,8 @@ class ExportControllerTest extends TestCase$repository->shouldReceive('changeStatus')->andReturn(true);$repository->shouldReceive('findByKey')->andReturn(new ExportJob);-$this->be($this->user());+$this->call('post', route('export.export'), $data);$this->assertResponseStatus(200);$this->see('ok');