Rename journal collector to more fitting transaction collector.

This commit is contained in:
James Cole
2018-08-11 14:33:47 +02:00
parent 96baf5d3c7
commit 9914c0791e
75 changed files with 595 additions and 1833 deletions

View File

@@ -24,7 +24,7 @@ declare(strict_types=1);
namespace Tests\Feature\Controllers\Budget;
use Carbon\Carbon;
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
use FireflyIII\Helpers\Collector\TransactionCollectorInterface;
use FireflyIII\Models\BudgetLimit;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
@@ -64,19 +64,19 @@ class ShowControllerTest extends TestCase
// mock stuff
$repository = $this->mock(BudgetRepositoryInterface::class);
$collector = $this->mock(JournalCollectorInterface::class);
$collector = $this->mock(TransactionCollectorInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('firstNull')->andReturn(null);
$collector->shouldReceive('setAllAssetAccounts')->andReturnSelf();
$collector->shouldReceive('setRange')->andReturnSelf();
$collector->shouldReceive('getJournals')->andReturn(new Collection);
$collector->shouldReceive('getTransactions')->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('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10));
$collector->shouldReceive('getPaginatedTransactions')->andReturn(new LengthAwarePaginator([], 0, 10));
$date = new Carbon();
$this->session(['start' => $date, 'end' => clone $date]);
@@ -100,7 +100,7 @@ class ShowControllerTest extends TestCase
Log::debug(sprintf('Now in testNoBudgetAll(%s)', $range));
// mock stuff
$repository = $this->mock(BudgetRepositoryInterface::class);
$collector = $this->mock(JournalCollectorInterface::class);
$collector = $this->mock(TransactionCollectorInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('firstNull')->andReturn(null);
@@ -112,8 +112,8 @@ class ShowControllerTest extends TestCase
$collector->shouldReceive('withOpposingAccount')->andReturnSelf();
$collector->shouldReceive('withoutBudget')->andReturnSelf();
$collector->shouldReceive('setTypes')->andReturnSelf();
$collector->shouldReceive('getJournals')->andReturn(new Collection);
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10));
$collector->shouldReceive('getTransactions')->andReturn(new Collection);
$collector->shouldReceive('getPaginatedTransactions')->andReturn(new LengthAwarePaginator([], 0, 10));
$date = new Carbon();
$this->session(['start' => $date, 'end' => clone $date]);
@@ -137,19 +137,19 @@ class ShowControllerTest extends TestCase
Log::debug(sprintf('Now in testNoBudgetDate(%s)', $range));
// mock stuff
$repository = $this->mock(BudgetRepositoryInterface::class);
$collector = $this->mock(JournalCollectorInterface::class);
$collector = $this->mock(TransactionCollectorInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('firstNull')->andReturn(null);
$collector->shouldReceive('setAllAssetAccounts')->andReturnSelf();
$collector->shouldReceive('setRange')->andReturnSelf();
$collector->shouldReceive('getJournals')->andReturn(new Collection);
$collector->shouldReceive('getTransactions')->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('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10));
$collector->shouldReceive('getPaginatedTransactions')->andReturn(new LengthAwarePaginator([], 0, 10));
$date = new Carbon();
$this->session(['start' => $date, 'end' => clone $date]);
@@ -179,13 +179,13 @@ class ShowControllerTest extends TestCase
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$collector = $this->mock(JournalCollectorInterface::class);
$collector = $this->mock(TransactionCollectorInterface::class);
$collector->shouldReceive('setAllAssetAccounts')->andReturnSelf();
$collector->shouldReceive('setRange')->andReturnSelf();
$collector->shouldReceive('setLimit')->andReturnSelf();
$collector->shouldReceive('setPage')->andReturnSelf();
$collector->shouldReceive('setBudget')->andReturnSelf();
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10));
$collector->shouldReceive('getPaginatedTransactions')->andReturn(new LengthAwarePaginator([], 0, 10));
$collector->shouldReceive('withBudgetInformation')->andReturnSelf();
$accountRepos = $this->mock(AccountRepositoryInterface::class);
@@ -246,14 +246,14 @@ class ShowControllerTest extends TestCase
$budgetRepository->shouldReceive('getBudgetLimits')->andReturn(new Collection);
// mock journal collector:
$collector = $this->mock(JournalCollectorInterface::class);
$collector = $this->mock(TransactionCollectorInterface::class);
$collector->shouldReceive('setAllAssetAccounts')->andReturnSelf();
$collector->shouldReceive('setRange')->andReturnSelf();
$collector->shouldReceive('setLimit')->andReturnSelf();
$collector->shouldReceive('setPage')->andReturnSelf();
$collector->shouldReceive('setBudget')->andReturnSelf();
$collector->shouldReceive('withBudgetInformation')->andReturnSelf();
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10));
$collector->shouldReceive('getPaginatedTransactions')->andReturn(new LengthAwarePaginator([], 0, 10));
$this->be($this->user());
$this->changeDateRange($this->user(), $range);