mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 16:57:09 +00:00
Update various tests.
This commit is contained in:
@@ -71,7 +71,7 @@ class MassControllerTest extends TestCase
|
||||
$repository = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$repository->shouldReceive('find')->andReturnValues([$deposits[0], $deposits[1]])->times(2);
|
||||
$repository->shouldReceive('delete')->times(2);
|
||||
$repository->shouldReceive('destroy')->times(2);
|
||||
|
||||
$this->session(['transactions.mass-delete.uri' => 'http://localhost']);
|
||||
|
||||
|
@@ -38,7 +38,6 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalTaskerInterface;
|
||||
use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface;
|
||||
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
|
||||
use Illuminate\Database\Query\JoinClause;
|
||||
@@ -813,19 +812,18 @@ class SingleControllerTest extends TestCase
|
||||
$attRepos = $this->mock(AttachmentHelperInterface::class);
|
||||
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$tasker = $this->mock(JournalTaskerInterface::class);
|
||||
$linkRepos = $this->mock(LinkTypeRepositoryInterface::class);
|
||||
|
||||
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal);
|
||||
$journalRepos->shouldReceive('getTransactionType')->andReturn('Withdrawal');
|
||||
$journalRepos->shouldReceive('getPiggyBankEvents')->andReturn(new Collection);
|
||||
$journalRepos->shouldReceive('getMetaField')->andReturn('');
|
||||
|
||||
$linkRepos->shouldReceive('get')->andReturn(new Collection);
|
||||
$linkRepos->shouldReceive('getLinks')->andReturn(new Collection);
|
||||
$attRepos->shouldReceive('saveAttachmentsForModel');
|
||||
$attRepos->shouldReceive('getErrors')->andReturn(new MessageBag);
|
||||
$attRepos->shouldReceive('getMessages')->andReturn(new MessageBag);
|
||||
$tasker->shouldReceive('getPiggyBankEvents')->andReturn(new Collection);
|
||||
$tasker->shouldReceive('getTransactionsOverview')->andReturn([]);
|
||||
|
||||
// mock
|
||||
try {
|
||||
|
@@ -31,7 +31,6 @@ use FireflyIII\Repositories\Bill\BillRepositoryInterface;
|
||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalTaskerInterface;
|
||||
use FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\MessageBag;
|
||||
@@ -59,7 +58,6 @@ class SplitControllerTest extends TestCase
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$budgetRepository = $this->mock(BudgetRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$tasker = $this->mock(JournalTaskerInterface::class);
|
||||
$attHelper = $this->mock(AttachmentHelperInterface::class);
|
||||
|
||||
|
||||
@@ -88,7 +86,6 @@ class SplitControllerTest extends TestCase
|
||||
|
||||
$currencyRepository->shouldReceive('get')->once()->andReturn(new Collection);
|
||||
$budgetRepository->shouldReceive('getActiveBudgets')->andReturn(new Collection);
|
||||
$tasker->shouldReceive('getTransactionsOverview')->andReturn($array);
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('transactions.split.edit', [$deposit->id]));
|
||||
@@ -111,7 +108,6 @@ class SplitControllerTest extends TestCase
|
||||
$budgetRepository = $this->mock(BudgetRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$attHelper = $this->mock(AttachmentHelperInterface::class);
|
||||
$tasker = $this->mock(JournalTaskerInterface::class);
|
||||
$deposit = TransactionJournal::where('transaction_type_id', 2)->where('user_id', $this->user()->id)->first();
|
||||
$destination = $deposit->transactions()->where('amount', '>', 0)->first();
|
||||
$account = $destination->account;
|
||||
@@ -120,7 +116,6 @@ class SplitControllerTest extends TestCase
|
||||
|
||||
$currencyRepository->shouldReceive('get')->once()->andReturn(new Collection);
|
||||
$budgetRepository->shouldReceive('getActiveBudgets')->andReturn(new Collection);
|
||||
$tasker->shouldReceive('getTransactionsOverview')->andReturn($transactions->toArray());
|
||||
|
||||
// mock for new account list and for account array
|
||||
$accountRepos->shouldReceive('getAccountsByType')
|
||||
@@ -209,7 +204,6 @@ class SplitControllerTest extends TestCase
|
||||
$budgetRepository = $this->mock(BudgetRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$attHelper = $this->mock(AttachmentHelperInterface::class);
|
||||
$tasker = $this->mock(JournalTaskerInterface::class);
|
||||
|
||||
$opening = TransactionJournal::where('transaction_type_id', 4)->where('user_id', $this->user()->id)->first();
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn($opening);
|
||||
@@ -232,7 +226,6 @@ class SplitControllerTest extends TestCase
|
||||
$budgetRepository = $this->mock(BudgetRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$attHelper = $this->mock(AttachmentHelperInterface::class);
|
||||
$tasker = $this->mock(JournalTaskerInterface::class);
|
||||
|
||||
$transactions = factory(Transaction::class, 1)->make();
|
||||
$deposit = TransactionJournal::where('transaction_type_id', 2)->where('user_id', $this->user()->id)->first();
|
||||
@@ -252,7 +245,6 @@ class SplitControllerTest extends TestCase
|
||||
|
||||
$currencyRepository->shouldReceive('get')->once()->andReturn(new Collection);
|
||||
$budgetRepository->shouldReceive('getActiveBudgets')->andReturn(new Collection);
|
||||
$tasker->shouldReceive('getTransactionsOverview')->andReturn($transactions->toArray());
|
||||
// mock for new account list and for account array
|
||||
$accountRepository->shouldReceive('getAccountsByType')
|
||||
->withArgs([[AccountType::ASSET, AccountType::DEFAULT]])->andReturn(new Collection([$account]))->twice();
|
||||
@@ -275,7 +267,6 @@ class SplitControllerTest extends TestCase
|
||||
$budgetRepository = $this->mock(BudgetRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$attHelper = $this->mock(AttachmentHelperInterface::class);
|
||||
$tasker = $this->mock(JournalTaskerInterface::class);
|
||||
$ruleRepos = $this->mock(RuleGroupRepositoryInterface::class);
|
||||
$billRepos = $this->mock(BillRepositoryInterface::class);
|
||||
|
||||
@@ -332,7 +323,6 @@ class SplitControllerTest extends TestCase
|
||||
$budgetRepository = $this->mock(BudgetRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$attHelper = $this->mock(AttachmentHelperInterface::class);
|
||||
$tasker = $this->mock(JournalTaskerInterface::class);
|
||||
|
||||
$this->session(['transactions.edit-split.uri' => 'http://localhost']);
|
||||
$opening = TransactionJournal::where('transaction_type_id', 4)->where('user_id', $this->user()->id)->first();
|
||||
@@ -375,7 +365,6 @@ class SplitControllerTest extends TestCase
|
||||
$budgetRepository = $this->mock(BudgetRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$attHelper = $this->mock(AttachmentHelperInterface::class);
|
||||
$tasker = $this->mock(JournalTaskerInterface::class);
|
||||
$ruleRepos = $this->mock(RuleGroupRepositoryInterface::class);
|
||||
$billRepos = $this->mock(BillRepositoryInterface::class);
|
||||
|
||||
@@ -432,7 +421,6 @@ class SplitControllerTest extends TestCase
|
||||
$budgetRepository = $this->mock(BudgetRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$attHelper = $this->mock(AttachmentHelperInterface::class);
|
||||
$tasker = $this->mock(JournalTaskerInterface::class);
|
||||
$ruleRepos = $this->mock(RuleGroupRepositoryInterface::class);
|
||||
$billRepos = $this->mock(BillRepositoryInterface::class);
|
||||
|
||||
|
@@ -28,7 +28,6 @@ use FireflyIII\Helpers\Filter\InternalTransferFilter;
|
||||
use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalTaskerInterface;
|
||||
use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Support\Collection;
|
||||
@@ -271,14 +270,10 @@ class TransactionControllerTest extends TestCase
|
||||
public function testShow()
|
||||
{
|
||||
// mock stuff
|
||||
$tasker = $this->mock(JournalTaskerInterface::class);
|
||||
$linkRepos = $this->mock(LinkTypeRepositoryInterface::class);
|
||||
$linkRepos->shouldReceive('get')->andReturn(new Collection);
|
||||
$linkRepos->shouldReceive('getLinks')->andReturn(new Collection);
|
||||
|
||||
$tasker->shouldReceive('getPiggyBankEvents')->andReturn(new Collection);
|
||||
$tasker->shouldReceive('getTransactionsOverview')->andReturn([]);
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('transactions.show', [1]));
|
||||
$response->assertStatus(200);
|
||||
@@ -291,7 +286,6 @@ class TransactionControllerTest extends TestCase
|
||||
*/
|
||||
public function testShowOpeningBalance()
|
||||
{
|
||||
$tasker = $this->mock(JournalTaskerInterface::class);
|
||||
$linkRepos = $this->mock(LinkTypeRepositoryInterface::class);
|
||||
$linkRepos->shouldReceive('get')->andReturn(new Collection);
|
||||
$linkRepos->shouldReceive('getLinks')->andReturn(new Collection);
|
||||
|
Reference in New Issue
Block a user