mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fix export controller tests.
This commit is contained in:
parent
87316cf7c1
commit
7c5bed2bb5
@ -124,7 +124,7 @@ class ExportJobRepository implements ExportJobRepositoryInterface
|
|||||||
/**
|
/**
|
||||||
* @param string $key
|
* @param string $key
|
||||||
*
|
*
|
||||||
* @return ExportJob|null
|
* @return ExportJob
|
||||||
*/
|
*/
|
||||||
public function findByKey(string $key): ExportJob
|
public function findByKey(string $key): ExportJob
|
||||||
{
|
{
|
||||||
|
@ -8,9 +8,13 @@
|
|||||||
*
|
*
|
||||||
* See the LICENSE file for details.
|
* See the LICENSE file for details.
|
||||||
*/
|
*/
|
||||||
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Export\Processor;
|
use FireflyIII\Export\Processor;
|
||||||
|
use FireflyIII\Export\ProcessorInterface;
|
||||||
use FireflyIII\Models\ExportJob;
|
use FireflyIII\Models\ExportJob;
|
||||||
|
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||||
use FireflyIII\Repositories\ExportJob\ExportJobRepositoryInterface;
|
use FireflyIII\Repositories\ExportJob\ExportJobRepositoryInterface;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generated by PHPUnit_SkeletonGenerator on 2016-12-10 at 05:51:41.
|
* Generated by PHPUnit_SkeletonGenerator on 2016-12-10 at 05:51:41.
|
||||||
@ -70,6 +74,11 @@ class ExportControllerTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testPostIndex()
|
public function testPostIndex()
|
||||||
{
|
{
|
||||||
|
$this->session(
|
||||||
|
['first' => new Carbon('2014-01-01')]
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
|
|
||||||
'export_start_range' => '2015-01-01',
|
'export_start_range' => '2015-01-01',
|
||||||
@ -78,7 +87,11 @@ class ExportControllerTest extends TestCase
|
|||||||
'accounts' => [1],
|
'accounts' => [1],
|
||||||
'job' => 'testExport',
|
'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('collectJournals')->once();
|
||||||
$processor->shouldReceive('convertJournals')->once();
|
$processor->shouldReceive('convertJournals')->once();
|
||||||
$processor->shouldReceive('exportJournals')->once();
|
$processor->shouldReceive('exportJournals')->once();
|
||||||
@ -88,8 +101,8 @@ class ExportControllerTest extends TestCase
|
|||||||
$repository->shouldReceive('changeStatus')->andReturn(true);
|
$repository->shouldReceive('changeStatus')->andReturn(true);
|
||||||
$repository->shouldReceive('findByKey')->andReturn(new ExportJob);
|
$repository->shouldReceive('findByKey')->andReturn(new ExportJob);
|
||||||
|
|
||||||
|
|
||||||
$this->be($this->user());
|
$this->be($this->user());
|
||||||
|
|
||||||
$this->call('post', route('export.export'), $data);
|
$this->call('post', route('export.export'), $data);
|
||||||
$this->assertResponseStatus(200);
|
$this->assertResponseStatus(200);
|
||||||
$this->see('ok');
|
$this->see('ok');
|
||||||
|
Loading…
Reference in New Issue
Block a user