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

@@ -23,7 +23,7 @@ declare(strict_types=1);
namespace Tests\Feature\Controllers;
use Carbon\Carbon;
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
use FireflyIII\Helpers\Collector\TransactionCollectorInterface;
use FireflyIII\Helpers\Filter\InternalTransferFilter;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
@@ -67,7 +67,7 @@ class TransactionControllerTest extends TestCase
// mock stuff
$transfer = $this->user()->transactionJournals()->inRandomOrder()->where('transaction_type_id', 3)->first();
$repository = $this->mock(JournalRepositoryInterface::class);
$collector = $this->mock(JournalCollectorInterface::class);
$collector = $this->mock(TransactionCollectorInterface::class);
$repository->shouldReceive('firstNull')->twice()->andReturn($transfer);
$collector->shouldReceive('setTypes')->andReturnSelf();
@@ -80,8 +80,8 @@ class TransactionControllerTest extends TestCase
$collector->shouldReceive('withCategoryInformation')->andReturnSelf();
$collector->shouldReceive('withOpposingAccount')->andReturnSelf();
$collector->shouldReceive('removeFilter')->withArgs([InternalTransferFilter::class])->andReturnSelf();
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10));
$collector->shouldReceive('getJournals')->andReturn(new Collection);
$collector->shouldReceive('getPaginatedTransactions')->andReturn(new LengthAwarePaginator([], 0, 10));
$collector->shouldReceive('getTransactions')->andReturn(new Collection);
$this->be($this->user());
$response = $this->get(route('transactions.index', ['transfer']));
@@ -101,7 +101,7 @@ class TransactionControllerTest extends TestCase
// mock stuff
$transfer = $this->user()->transactionJournals()->inRandomOrder()->where('transaction_type_id', 3)->first();
$repository = $this->mock(JournalRepositoryInterface::class);
$collector = $this->mock(JournalCollectorInterface::class);
$collector = $this->mock(TransactionCollectorInterface::class);
$repository->shouldReceive('firstNull')->twice()->andReturn($transfer);
$collector->shouldReceive('setTypes')->andReturnSelf();
@@ -114,8 +114,8 @@ class TransactionControllerTest extends TestCase
$collector->shouldReceive('withCategoryInformation')->andReturnSelf();
$collector->shouldReceive('withOpposingAccount')->andReturnSelf();
$collector->shouldReceive('removeFilter')->withArgs([InternalTransferFilter::class])->andReturnSelf();
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10));
$collector->shouldReceive('getJournals')->andReturn(new Collection);
$collector->shouldReceive('getPaginatedTransactions')->andReturn(new LengthAwarePaginator([], 0, 10));
$collector->shouldReceive('getTransactions')->andReturn(new Collection);
$this->be($this->user());
$response = $this->get(route('transactions.index.all', ['transfer']));
@@ -142,7 +142,7 @@ class TransactionControllerTest extends TestCase
// mock stuff
$repository = $this->mock(JournalRepositoryInterface::class);
$collector = $this->mock(JournalCollectorInterface::class);
$collector = $this->mock(TransactionCollectorInterface::class);
$transfer = $this->user()->transactionJournals()->inRandomOrder()->where('transaction_type_id', 3)->first();
$repository->shouldReceive('firstNull')->once()->andReturn($transfer);
$repository->shouldReceive('firstNull')->once()->andReturn($transfer);
@@ -157,8 +157,8 @@ class TransactionControllerTest extends TestCase
$collector->shouldReceive('withCategoryInformation')->andReturnSelf();
$collector->shouldReceive('withOpposingAccount')->andReturnSelf();
$collector->shouldReceive('removeFilter')->withArgs([InternalTransferFilter::class])->andReturnSelf();
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10));
$collector->shouldReceive('getJournals')->andReturn($collection);
$collector->shouldReceive('getPaginatedTransactions')->andReturn(new LengthAwarePaginator([], 0, 10));
$collector->shouldReceive('getTransactions')->andReturn($collection);
$this->be($this->user());
$response = $this->get(route('transactions.index', ['transfer', '2016-01-01']));
@@ -185,7 +185,7 @@ class TransactionControllerTest extends TestCase
// mock stuff
$repository = $this->mock(JournalRepositoryInterface::class);
$collector = $this->mock(JournalCollectorInterface::class);
$collector = $this->mock(TransactionCollectorInterface::class);
$transfer = $this->user()->transactionJournals()->inRandomOrder()->where('transaction_type_id', 3)->first();
$repository->shouldReceive('firstNull')->once()->andReturn($transfer);
$repository->shouldReceive('firstNull')->once()->andReturn($transfer);
@@ -200,8 +200,8 @@ class TransactionControllerTest extends TestCase
$collector->shouldReceive('withCategoryInformation')->andReturnSelf();
$collector->shouldReceive('withOpposingAccount')->andReturnSelf();
$collector->shouldReceive('removeFilter')->withArgs([InternalTransferFilter::class])->andReturnSelf();
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10));
$collector->shouldReceive('getJournals')->andReturn($collection);
$collector->shouldReceive('getPaginatedTransactions')->andReturn(new LengthAwarePaginator([], 0, 10));
$collector->shouldReceive('getTransactions')->andReturn($collection);
$this->be($this->user());
$response = $this->get(route('transactions.index', ['transfer', '2016-01-01', '2015-12-31']));
@@ -228,7 +228,7 @@ class TransactionControllerTest extends TestCase
// mock stuff
$repository = $this->mock(JournalRepositoryInterface::class);
$collector = $this->mock(JournalCollectorInterface::class);
$collector = $this->mock(TransactionCollectorInterface::class);
$transfer = $this->user()->transactionJournals()->inRandomOrder()->where('transaction_type_id', 3)->first();
$repository->shouldReceive('firstNull')->once()->andReturn($transfer);
$repository->shouldReceive('firstNull')->once()->andReturn($transfer);
@@ -243,8 +243,8 @@ class TransactionControllerTest extends TestCase
$collector->shouldReceive('withCategoryInformation')->andReturnSelf();
$collector->shouldReceive('withOpposingAccount')->andReturnSelf();
$collector->shouldReceive('removeFilter')->withArgs([InternalTransferFilter::class])->andReturnSelf();
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10));
$collector->shouldReceive('getJournals')->andReturn($collection);
$collector->shouldReceive('getPaginatedTransactions')->andReturn(new LengthAwarePaginator([], 0, 10));
$collector->shouldReceive('getTransactions')->andReturn($collection);
$this->be($this->user());
$response = $this->get(route('transactions.index', ['deposit']));
@@ -271,7 +271,7 @@ class TransactionControllerTest extends TestCase
// mock stuff
$repository = $this->mock(JournalRepositoryInterface::class);
$collector = $this->mock(JournalCollectorInterface::class);
$collector = $this->mock(TransactionCollectorInterface::class);
$transfer = $this->user()->transactionJournals()->inRandomOrder()->where('transaction_type_id', 3)->first();
$repository->shouldReceive('firstNull')->once()->andReturn($transfer);
$repository->shouldReceive('firstNull')->once()->andReturn($transfer);
@@ -286,8 +286,8 @@ class TransactionControllerTest extends TestCase
$collector->shouldReceive('withCategoryInformation')->andReturnSelf();
$collector->shouldReceive('withOpposingAccount')->andReturnSelf();
$collector->shouldReceive('removeFilter')->withArgs([InternalTransferFilter::class])->andReturnSelf();
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10));
$collector->shouldReceive('getJournals')->andReturn($collection);
$collector->shouldReceive('getPaginatedTransactions')->andReturn(new LengthAwarePaginator([], 0, 10));
$collector->shouldReceive('getTransactions')->andReturn($collection);
$this->be($this->user());
$response = $this->get(route('transactions.index', ['withdrawal']));