mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-05 20:10:57 +00:00
Built chart tests.
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Collection;
|
||||
use League\FactoryMuffin\Facade as FactoryMuffin;
|
||||
|
||||
/**
|
||||
* Class ChartBillControllerTest
|
||||
*/
|
||||
@@ -20,17 +24,62 @@ class ChartBillControllerTest extends TestCase
|
||||
*/
|
||||
public function tearDown()
|
||||
{
|
||||
parent::tearDown();
|
||||
$user = FactoryMuffin::create('FireflyIII\User');
|
||||
$this->be($user);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function testFrontpage()
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
$user = FactoryMuffin::create('FireflyIII\User');
|
||||
$this->be($user);
|
||||
|
||||
// set!
|
||||
$bills = new Collection([FactoryMuffin::create('FireflyIII\Models\Bill'), FactoryMuffin::create('FireflyIII\Models\Bill')]);
|
||||
$journals = new Collection(
|
||||
[FactoryMuffin::create('FireflyIII\Models\TransactionJournal'), FactoryMuffin::create('FireflyIII\Models\TransactionJournal')]
|
||||
);
|
||||
$creditCards = new Collection([FactoryMuffin::create('FireflyIII\Models\Account'), FactoryMuffin::create('FireflyIII\Models\Account')]);
|
||||
$ranges = [['start' => new Carbon, 'end' => new Carbon]];
|
||||
|
||||
// mock!
|
||||
$repository = $this->mock('FireflyIII\Repositories\Bill\BillRepositoryInterface');
|
||||
$accounts = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface');
|
||||
|
||||
|
||||
// fake!
|
||||
$repository->shouldReceive('getActiveBills')->andReturn($bills);
|
||||
$repository->shouldReceive('getRanges')->andReturn($ranges);
|
||||
$repository->shouldReceive('getJournalsInRange')->andReturn(new Collection, $journals);
|
||||
$accounts->shouldReceive('getCreditCards')->andReturn($creditCards);
|
||||
$accounts->shouldReceive('getTransfersInRange')->andReturn(new Collection);
|
||||
$repository->shouldReceive('createFakeBill')->andReturn($bills->first());
|
||||
Steam::shouldReceive('balance')->andReturn(-10,0);
|
||||
|
||||
|
||||
$this->call('GET', '/chart/bill/frontpage');
|
||||
$this->assertResponseOk();
|
||||
|
||||
}
|
||||
|
||||
public function testSingle()
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
$bill = FactoryMuffin::create('FireflyIII\Models\Bill');
|
||||
$this->be($bill->user);
|
||||
|
||||
// set
|
||||
$journals = new Collection([FactoryMuffin::create('FireflyIII\Models\TransactionJournal')]);
|
||||
|
||||
// mock!
|
||||
$repository = $this->mock('FireflyIII\Repositories\Bill\BillRepositoryInterface');
|
||||
$repository->shouldReceive('getJournals')->andReturn($journals);
|
||||
|
||||
// fake!
|
||||
|
||||
$this->call('GET', '/chart/bill/' . $bill->id);
|
||||
$this->assertResponseOk();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user