mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
90 lines
2.3 KiB
PHP
90 lines
2.3 KiB
PHP
<?php
|
|
/**
|
|
* ExportControllerTest.php
|
|
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
|
*
|
|
* This software may be modified and distributed under the terms of the
|
|
* Creative Commons Attribution-ShareAlike 4.0 International License.
|
|
*
|
|
* See the LICENSE file for details.
|
|
*/
|
|
use FireflyIII\Export\Processor;
|
|
|
|
|
|
/**
|
|
* Generated by PHPUnit_SkeletonGenerator on 2016-12-10 at 05:51:41.
|
|
*/
|
|
class ExportControllerTest extends TestCase
|
|
{
|
|
|
|
|
|
/**
|
|
* Sets up the fixture, for example, opens a network connection.
|
|
* This method is called before a test is executed.
|
|
*/
|
|
public function setUp()
|
|
{
|
|
parent::setUp();
|
|
}
|
|
|
|
/**
|
|
* @covers \FireflyIII\Http\Controllers\ExportController::download
|
|
*/
|
|
public function testDownload()
|
|
{
|
|
$this->be($this->user());
|
|
$this->call('GET', route('export.download', ['testExport']));
|
|
$this->assertResponseStatus(200);
|
|
}
|
|
|
|
/**
|
|
* @covers \FireflyIII\Http\Controllers\ExportController::getStatus
|
|
*/
|
|
public function testGetStatus()
|
|
{
|
|
$this->be($this->user());
|
|
$this->call('GET', route('export.status', ['testExport']));
|
|
$this->assertResponseStatus(200);
|
|
}
|
|
|
|
/**
|
|
* @covers \FireflyIII\Http\Controllers\ExportController::index
|
|
*/
|
|
public function testIndex()
|
|
{
|
|
$this->be($this->user());
|
|
$this->call('GET', route('export.index'));
|
|
$this->assertResponseStatus(200);
|
|
|
|
// has bread crumb
|
|
$this->see('<ol class="breadcrumb">');
|
|
}
|
|
|
|
/**
|
|
* @covers \FireflyIII\Http\Controllers\ExportController::postIndex
|
|
*/
|
|
public function testPostIndex()
|
|
{
|
|
$data = [
|
|
|
|
'export_start_range' => '2015-01-01',
|
|
'export_end_range' => '2015-01-21',
|
|
'exportFormat' => 'csv',
|
|
'accounts' => [1],
|
|
'job' => 'testExport',
|
|
];
|
|
$processor = $this->mock(Processor::class);
|
|
$processor->shouldReceive('collectJournals')->once();
|
|
$processor->shouldReceive('convertJournals')->once();
|
|
$processor->shouldReceive('exportJournals')->once();
|
|
$processor->shouldReceive('createZipFile')->once();
|
|
|
|
|
|
$this->be($this->user());
|
|
$this->call('post', route('export.export'), $data);
|
|
$this->assertResponseStatus(200);
|
|
$this->see('ok');
|
|
}
|
|
|
|
}
|