Expand tests.

This commit is contained in:
James Cole
2017-03-12 08:38:13 +01:00
parent 8f14c78ba1
commit 65dbfcba5c
4 changed files with 102 additions and 18 deletions

View File

@@ -12,9 +12,12 @@ declare(strict_types = 1);
namespace Tests\Feature\Controllers\Chart;
use FireflyIII\Generator\Chart\Basic\GeneratorInterface;
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use Illuminate\Support\Collection;
use Tests\TestCase;
class BillControllerTest extends TestCase
{
/**
@@ -26,6 +29,13 @@ class BillControllerTest extends TestCase
*/
public function testFrontpage(string $range)
{
$generator = $this->mock(GeneratorInterface::class);
$repository = $this->mock(BillRepositoryInterface::class);
$repository->shouldReceive('getBillsPaidInRange')->once()->andReturn('-1');
$repository->shouldReceive('getBillsUnpaidInRange')->once()->andReturn('2');
$generator->shouldReceive('pieChart')->once()->andReturn([]);
$this->be($this->user());
$this->changeDateRange($this->user(), $range);
$response = $this->get(route('chart.bill.frontpage'));
@@ -37,6 +47,15 @@ class BillControllerTest extends TestCase
*/
public function testSingle()
{
$generator = $this->mock(GeneratorInterface::class);
$collector = $this->mock(JournalCollectorInterface::class);
$collector->shouldReceive('setAllAssetAccounts')->andReturnSelf()->once();
$collector->shouldReceive('setBills')->andReturnSelf()->once();
$collector->shouldReceive('getJournals')->andReturn(new Collection)->once();
$generator->shouldReceive('multiSet')->once()->andReturn([]);
$this->be($this->user());
$response = $this->get(route('chart.bill.single', [1]));
$response->assertStatus(200);