mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-29 18:20:01 +00:00
Optimized some views and fixed tests for #595
This commit is contained in:
@@ -158,8 +158,8 @@ class AccountControllerTest extends TestCase
|
||||
$tasker->shouldReceive('amountInInPeriod')->withAnyArgs()->andReturn('1');
|
||||
|
||||
$repository = $this->mock(AccountRepositoryInterface::class);
|
||||
$repository->shouldReceive('oldestJournalDate')->andReturn(clone $date);
|
||||
$repository->shouldReceive('getAccountsByType')->andReturn(new Collection);
|
||||
$repository->shouldReceive('oldestJournalDate')->andReturn(clone $date)->once();
|
||||
$repository->shouldReceive('getAccountsByType')->andReturn(new Collection)->once();
|
||||
|
||||
$transaction = factory(Transaction::class)->make();
|
||||
$collector = $this->mock(JournalCollectorInterface::class);
|
||||
@@ -190,7 +190,7 @@ class AccountControllerTest extends TestCase
|
||||
$transaction = factory(Transaction::class)->make();
|
||||
$collector = $this->mock(JournalCollectorInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$journalRepos->shouldReceive('first')->twice()->andReturn(new TransactionJournal);
|
||||
$collector->shouldReceive('setAccounts')->andReturnSelf();
|
||||
$collector->shouldReceive('setRange')->andReturnSelf();
|
||||
$collector->shouldReceive('setLimit')->andReturnSelf();
|
||||
@@ -202,10 +202,6 @@ class AccountControllerTest extends TestCase
|
||||
$tasker->shouldReceive('amountOutInPeriod')->withAnyArgs()->andReturn('-1');
|
||||
$tasker->shouldReceive('amountInInPeriod')->withAnyArgs()->andReturn('1');
|
||||
|
||||
$repository = $this->mock(AccountRepositoryInterface::class);
|
||||
$repository->shouldReceive('oldestJournalDate')->andReturn(new Carbon)->once();
|
||||
$repository->shouldReceive('getAccountsByType')->withArgs([[AccountType::ASSET, AccountType::DEFAULT]])->once()->andReturn(new Collection);
|
||||
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$response = $this->get(route('accounts.show', [1, 'all']));
|
||||
@@ -253,14 +249,14 @@ class AccountControllerTest extends TestCase
|
||||
|
||||
$tasker = $this->mock(AccountTaskerInterface::class);
|
||||
$repository = $this->mock(AccountRepositoryInterface::class);
|
||||
$repository->shouldReceive('oldestJournalDate')->andReturn(new Carbon);
|
||||
$repository->shouldReceive('oldestJournalDate')->andReturn(new Carbon)->once();
|
||||
$repository->shouldReceive('getAccountsByType')->withArgs([[AccountType::ASSET, AccountType::DEFAULT]])->once()->andReturn(new Collection);
|
||||
$tasker->shouldReceive('amountOutInPeriod')->withAnyArgs()->andReturn('-1');
|
||||
$tasker->shouldReceive('amountInInPeriod')->withAnyArgs()->andReturn('1');
|
||||
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$response = $this->get(route('accounts.show.date', [1, '2016-01-01']));
|
||||
$response = $this->get(route('accounts.show', [1, '2016-01-01']));
|
||||
$response->assertStatus(200);
|
||||
// has bread crumb
|
||||
$response->assertSee('<ol class="breadcrumb">');
|
||||
@@ -293,7 +289,7 @@ class AccountControllerTest extends TestCase
|
||||
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$response = $this->get(route('accounts.show.date', [1, '2016-01-01']));
|
||||
$response = $this->get(route('accounts.show', [1, '2016-01-01']));
|
||||
$response->assertStatus(200);
|
||||
// has bread crumb
|
||||
$response->assertSee('<ol class="breadcrumb">');
|
||||
|
@@ -159,7 +159,9 @@ class BudgetControllerTest extends TestCase
|
||||
$collector->shouldReceive('getJournals')->andReturn(new Collection);
|
||||
$collector->shouldReceive('setLimit')->andReturnSelf();
|
||||
$collector->shouldReceive('setPage')->andReturnSelf();
|
||||
$collector->shouldReceive('setTypes')->andReturnSelf();
|
||||
$collector->shouldReceive('withoutBudget')->andReturnSelf();
|
||||
$collector->shouldReceive('withOpposingAccount')->andReturnSelf();
|
||||
$collector->shouldReceive('withCategoryInformation')->andReturnSelf();
|
||||
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10));
|
||||
|
||||
@@ -190,8 +192,11 @@ class BudgetControllerTest extends TestCase
|
||||
$collector->shouldReceive('setAllAssetAccounts')->andReturnSelf();
|
||||
$collector->shouldReceive('setRange')->andReturnSelf();
|
||||
$collector->shouldReceive('setLimit')->andReturnSelf();
|
||||
$collector->shouldReceive('setTypes')->andReturnSelf();
|
||||
$collector->shouldReceive('setPage')->andReturnSelf();
|
||||
$collector->shouldReceive('withOpposingAccount')->andReturnSelf();
|
||||
$collector->shouldReceive('withoutBudget')->andReturnSelf();
|
||||
$collector->shouldReceive('setTypes')->andReturnSelf();
|
||||
$collector->shouldReceive('withCategoryInformation')->andReturnSelf();
|
||||
$collector->shouldReceive('getJournals')->andReturn(new Collection);
|
||||
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10));
|
||||
@@ -226,6 +231,8 @@ class BudgetControllerTest extends TestCase
|
||||
$collector->shouldReceive('getJournals')->andReturn(new Collection);
|
||||
$collector->shouldReceive('setLimit')->andReturnSelf();
|
||||
$collector->shouldReceive('setPage')->andReturnSelf();
|
||||
$collector->shouldReceive('withOpposingAccount')->andReturnSelf();
|
||||
$collector->shouldReceive('setTypes')->andReturnSelf();
|
||||
$collector->shouldReceive('withoutBudget')->andReturnSelf();
|
||||
$collector->shouldReceive('withCategoryInformation')->andReturnSelf();
|
||||
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10));
|
||||
|
Reference in New Issue
Block a user