Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Fix test method names.
James Coleeaf2667abb5b
diff --git a/tests/Api/V1/Controllers/AboutControllerTest.php b/tests/Api/V1/Controllers/AboutControllerTest.phpindex 38094b4c0e..2622b2d56c 100644--- a/tests/Api/V1/Controllers/AboutControllerTest.php+++ b/tests/Api/V1/Controllers/AboutControllerTest.php@@ -35,7 +35,7 @@ class AboutControllerTest extends TestCase/*** Set up test*/- public function setUp()+ public function setUp(): void{parent::setUp();Passport::actingAs($this->user());diff --git a/tests/Api/V1/Controllers/AvailableBudgetControllerTest.php b/tests/Api/V1/Controllers/AvailableBudgetControllerTest.phpindex 65bd2f7295..a37c12f2b7 100644--- a/tests/Api/V1/Controllers/AvailableBudgetControllerTest.php+++ b/tests/Api/V1/Controllers/AvailableBudgetControllerTest.php@@ -154,20 +154,16 @@ class AvailableBudgetControllerTest extends TestCase* @covers \FireflyIII\Api\V1\Controllers\AvailableBudgetController* @covers \FireflyIII\Api\V1\Requests\AvailableBudgetRequest*/- public function testStoreNoCurrencyId(): void+ public function testStoreNoCurrencyAtAll(): void{- /** @var AvailableBudget $availableBudget */- $availableBudget = $this->user()->availableBudgets()->first();-// mock stuff:$repository = $this->mock(BudgetRepositoryInterface::class);$currencyRepository = $this->mock(CurrencyRepositoryInterface::class);// mock calls:$repository->shouldReceive('setUser')->once();- $repository->shouldReceive('setAvailableBudget')->once()->andReturn($availableBudget);$currencyRepository->shouldReceive('findNull')->withArgs([1])->andReturn(null)->once();- $currencyRepository->shouldReceive('findByCodeNull')->withArgs(['EUR'])->andReturn(TransactionCurrency::find(1))->once();+ $currencyRepository->shouldReceive('findByCodeNull')->withArgs(['EUR'])->andReturn(null)->once();// data to submit$data = [@@ -180,28 +176,32 @@ class AvailableBudgetControllerTest extends TestCase// test API- $response = $this->post('/api/v1/available_budgets', $data);- $response->assertStatus(200);- $response->assertJson(['data' => ['type' => 'available_budgets', 'links' => true],]);- $response->assertSee($availableBudget->amount); // the amount- $response->assertHeader('Content-Type', 'application/vnd.api+json');+ $response = $this->post('/api/v1/available_budgets', $data, ['Accept' => 'application/json']);+ $response->assertStatus(500);+ $response->assertSee('Could not find the indicated currency.'); // the amount+ $response->assertHeader('Content-Type', 'application/json');}+/*** Store new available budget without a valid currency.** @covers \FireflyIII\Api\V1\Controllers\AvailableBudgetController* @covers \FireflyIII\Api\V1\Requests\AvailableBudgetRequest*/- public function testStoreNoCurrencyAtAll(): void+ public function testStoreNoCurrencyId(): void{+ /** @var AvailableBudget $availableBudget */+ $availableBudget = $this->user()->availableBudgets()->first();+// mock stuff:$repository = $this->mock(BudgetRepositoryInterface::class);$currencyRepository = $this->mock(CurrencyRepositoryInterface::class);// mock calls:$repository->shouldReceive('setUser')->once();+ $repository->shouldReceive('setAvailableBudget')->once()->andReturn($availableBudget);$currencyRepository->shouldReceive('findNull')->withArgs([1])->andReturn(null)->once();- $currencyRepository->shouldReceive('findByCodeNull')->withArgs(['EUR'])->andReturn(null)->once();+ $currencyRepository->shouldReceive('findByCodeNull')->withArgs(['EUR'])->andReturn(TransactionCurrency::find(1))->once();// data to submit$data = [@@ -214,13 +214,13 @@ class AvailableBudgetControllerTest extends TestCase// test API- $response = $this->post('/api/v1/available_budgets', $data, ['Accept' => 'application/json']);- $response->assertStatus(500);- $response->assertSee('Could not find the indicated currency.'); // the amount- $response->assertHeader('Content-Type', 'application/json');+ $response = $this->post('/api/v1/available_budgets', $data);+ $response->assertStatus(200);+ $response->assertJson(['data' => ['type' => 'available_budgets', 'links' => true],]);+ $response->assertSee($availableBudget->amount); // the amount+ $response->assertHeader('Content-Type', 'application/vnd.api+json');}-/*** Update available budget.*diff --git a/tests/Api/V1/Controllers/BillControllerTest.php b/tests/Api/V1/Controllers/BillControllerTest.phpindex 774037d255..01da6566f1 100644--- a/tests/Api/V1/Controllers/BillControllerTest.php+++ b/tests/Api/V1/Controllers/BillControllerTest.php@@ -40,7 +40,7 @@ class BillControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Passport::actingAs($this->user());diff --git a/tests/Api/V1/Controllers/PiggyBankControllerTest.php b/tests/Api/V1/Controllers/PiggyBankControllerTest.phpindex 6b80771ee0..7c24398e80 100644--- a/tests/Api/V1/Controllers/PiggyBankControllerTest.php+++ b/tests/Api/V1/Controllers/PiggyBankControllerTest.php@@ -239,7 +239,7 @@ class PiggyBankControllerTest extends TestCase$currencyRepos->shouldReceive('findNull')->withArgs([1])->andReturn(TransactionCurrency::first());$data = [- 'name' => 'new pigy bank ' . random_int(1, 10000),+ 'name' => 'new pigy bank ' . random_int(1, 10000),'account_id' => 1,'target_amount' => '100',];diff --git a/tests/Api/V1/Controllers/RuleControllerTest.php b/tests/Api/V1/Controllers/RuleControllerTest.phpindex 86f195db9d..2f5dc9adee 100644--- a/tests/Api/V1/Controllers/RuleControllerTest.php+++ b/tests/Api/V1/Controllers/RuleControllerTest.php@@ -146,11 +146,10 @@ class RuleControllerTest extends TestCase* @covers \FireflyIII\Api\V1\Controllers\RuleController* @covers \FireflyIII\Api\V1\Requests\RuleRequest*/- public function testUpdate(): void+ public function testStoreNoActions(): void{$ruleRepos = $this->mock(RuleRepositoryInterface::class);$ruleRepos->shouldReceive('setUser')->once();- /** @var Rule $rule */$rule = $this->user()->rules()->first();$data = ['title' => 'Store new rule',@@ -167,20 +166,12 @@ class RuleControllerTest extends TestCase],],'rule_actions' => [- [- 'name' => 'add_tag',- 'value' => 'A',- 'stop_processing' => 1,- ],],];- $ruleRepos->shouldReceive('update')->once()->andReturn($rule);-// test API- $response = $this->put('/api/v1/rules/' . $rule->id, $data, ['Accept' => 'application/json']);- $response->assertStatus(200);-+ $response = $this->post('/api/v1/rules', $data, ['Accept' => 'application/json']);+ $response->assertStatus(422);}/**@@ -217,15 +208,15 @@ class RuleControllerTest extends TestCase}-/*** @covers \FireflyIII\Api\V1\Controllers\RuleController* @covers \FireflyIII\Api\V1\Requests\RuleRequest*/- public function testStoreNoActions(): void+ public function testUpdate(): void{$ruleRepos = $this->mock(RuleRepositoryInterface::class);$ruleRepos->shouldReceive('setUser')->once();+ /** @var Rule $rule */$rule = $this->user()->rules()->first();$data = ['title' => 'Store new rule',@@ -242,12 +233,20 @@ class RuleControllerTest extends TestCase],],'rule_actions' => [+ [+ 'name' => 'add_tag',+ 'value' => 'A',+ 'stop_processing' => 1,+ ],],];+ $ruleRepos->shouldReceive('update')->once()->andReturn($rule);+// test API- $response = $this->post('/api/v1/rules', $data, ['Accept' => 'application/json']);- $response->assertStatus(422);+ $response = $this->put('/api/v1/rules/' . $rule->id, $data, ['Accept' => 'application/json']);+ $response->assertStatus(200);+}}\ No newline at end of filediff --git a/tests/Api/V1/Controllers/RuleGroupControllerTest.php b/tests/Api/V1/Controllers/RuleGroupControllerTest.phpindex f77ea61029..c21b7785ab 100644--- a/tests/Api/V1/Controllers/RuleGroupControllerTest.php+++ b/tests/Api/V1/Controllers/RuleGroupControllerTest.php@@ -90,7 +90,7 @@ class RuleGroupControllerTest extends TestCasepublic function testShow(): void{/** @var RuleGroup $ruleGroup */- $ruleGroup = $this->user()->ruleGroups()->first();+ $ruleGroup = $this->user()->ruleGroups()->first();$ruleGroupRepos = $this->mock(RuleGroupRepositoryInterface::class);$ruleGroupRepos->shouldReceive('setUser')->once();diff --git a/tests/Api/V1/Controllers/UserControllerTest.php b/tests/Api/V1/Controllers/UserControllerTest.phpindex a54d8db930..489c205554 100644--- a/tests/Api/V1/Controllers/UserControllerTest.php+++ b/tests/Api/V1/Controllers/UserControllerTest.php@@ -40,7 +40,7 @@ class UserControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Passport::actingAs($this->user());diff --git a/tests/Feature/Controllers/Account/ShowControllerTest.php b/tests/Feature/Controllers/Account/ShowControllerTest.phpindex 149069dcc5..238d030730 100644--- a/tests/Feature/Controllers/Account/ShowControllerTest.php+++ b/tests/Feature/Controllers/Account/ShowControllerTest.php@@ -100,41 +100,6 @@ class ShowControllerTest extends TestCase$response->assertSee('<ol class="breadcrumb">');}- /**- * @covers \FireflyIII\Http\Controllers\Account\ShowController- * @dataProvider dateRangeProvider- *- * @param string $range- */- public function testShowLiability(string $range): void- {- $date = new Carbon;- $this->session(['start' => $date, 'end' => clone $date]);- $account = $this->user()->accounts()->where('account_type_id', 12)->whereNull('deleted_at')->first();-- // mock stuff:- $tasker = $this->mock(AccountTaskerInterface::class);- $journalRepos = $this->mock(JournalRepositoryInterface::class);- $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);-- $currencyRepos->shouldReceive('findNull')->andReturn(TransactionCurrency::find(1));-- $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);- $tasker->shouldReceive('amountOutInPeriod')->withAnyArgs()->andReturn('-1');- $tasker->shouldReceive('amountInInPeriod')->withAnyArgs()->andReturn('1');-- $repository = $this->mock(AccountRepositoryInterface::class);- $repository->shouldReceive('getMetaValue')->andReturn('');- $repository->shouldReceive('isLiability')->andReturn(true);-- $this->be($this->user());- $this->changeDateRange($this->user(), $range);- $response = $this->get(route('accounts.show', [$account->id]));- $response->assertStatus(302);- $response->assertRedirect(route('accounts.show.all', [$account->id]));- }--/*** @covers \FireflyIII\Http\Controllers\Account\ShowController* @dataProvider dateRangeProvider@@ -277,4 +242,38 @@ class ShowControllerTest extends TestCase$response->assertStatus(302);}+ /**+ * @covers \FireflyIII\Http\Controllers\Account\ShowController+ * @dataProvider dateRangeProvider+ *+ * @param string $range+ */+ public function testShowLiability(string $range): void+ {+ $date = new Carbon;+ $this->session(['start' => $date, 'end' => clone $date]);+ $account = $this->user()->accounts()->where('account_type_id', 12)->whereNull('deleted_at')->first();++ // mock stuff:+ $tasker = $this->mock(AccountTaskerInterface::class);+ $journalRepos = $this->mock(JournalRepositoryInterface::class);+ $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);++ $currencyRepos->shouldReceive('findNull')->andReturn(TransactionCurrency::find(1));++ $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);+ $tasker->shouldReceive('amountOutInPeriod')->withAnyArgs()->andReturn('-1');+ $tasker->shouldReceive('amountInInPeriod')->withAnyArgs()->andReturn('1');++ $repository = $this->mock(AccountRepositoryInterface::class);+ $repository->shouldReceive('getMetaValue')->andReturn('');+ $repository->shouldReceive('isLiability')->andReturn(true);++ $this->be($this->user());+ $this->changeDateRange($this->user(), $range);+ $response = $this->get(route('accounts.show', [$account->id]));+ $response->assertStatus(302);+ $response->assertRedirect(route('accounts.show.all', [$account->id]));+ }+}diff --git a/tests/Feature/Controllers/Admin/ConfigurationControllerTest.php b/tests/Feature/Controllers/Admin/ConfigurationControllerTest.phpindex 57afe3ac2d..ba164baeaf 100644--- a/tests/Feature/Controllers/Admin/ConfigurationControllerTest.php+++ b/tests/Feature/Controllers/Admin/ConfigurationControllerTest.php@@ -35,7 +35,7 @@ class ConfigurationControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/Admin/HomeControllerTest.php b/tests/Feature/Controllers/Admin/HomeControllerTest.phpindex 4a147aaaf4..d108af0459 100644--- a/tests/Feature/Controllers/Admin/HomeControllerTest.php+++ b/tests/Feature/Controllers/Admin/HomeControllerTest.php@@ -35,7 +35,7 @@ class HomeControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/Admin/LinkControllerTest.php b/tests/Feature/Controllers/Admin/LinkControllerTest.phpindex 6a14b4ea01..6ea0c3567d 100644--- a/tests/Feature/Controllers/Admin/LinkControllerTest.php+++ b/tests/Feature/Controllers/Admin/LinkControllerTest.php@@ -36,7 +36,7 @@ class LinkControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/Admin/UpdateControllerTest.php b/tests/Feature/Controllers/Admin/UpdateControllerTest.phpindex 35603f58aa..f331bb5e3d 100644--- a/tests/Feature/Controllers/Admin/UpdateControllerTest.php+++ b/tests/Feature/Controllers/Admin/UpdateControllerTest.php@@ -40,7 +40,7 @@ class UpdateControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/AttachmentControllerTest.php b/tests/Feature/Controllers/AttachmentControllerTest.phpindex d53f4b8dd0..d7dc41f2d3 100644--- a/tests/Feature/Controllers/AttachmentControllerTest.php+++ b/tests/Feature/Controllers/AttachmentControllerTest.php@@ -42,7 +42,7 @@ class AttachmentControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/Auth/ForgotPasswordControllerTest.php b/tests/Feature/Controllers/Auth/ForgotPasswordControllerTest.phpindex e20381f0ee..6361f0095e 100644--- a/tests/Feature/Controllers/Auth/ForgotPasswordControllerTest.php+++ b/tests/Feature/Controllers/Auth/ForgotPasswordControllerTest.php@@ -34,7 +34,7 @@ class ForgotPasswordControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/Auth/TwoFactorControllerTest.php b/tests/Feature/Controllers/Auth/TwoFactorControllerTest.phpindex ab9be7b766..f196fd401c 100644--- a/tests/Feature/Controllers/Auth/TwoFactorControllerTest.php+++ b/tests/Feature/Controllers/Auth/TwoFactorControllerTest.php@@ -36,7 +36,7 @@ class TwoFactorControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/BillControllerTest.php b/tests/Feature/Controllers/BillControllerTest.phpindex dbcf32a4d1..a4d6e1ea6c 100644--- a/tests/Feature/Controllers/BillControllerTest.php+++ b/tests/Feature/Controllers/BillControllerTest.php@@ -51,7 +51,7 @@ class BillControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/Budget/AmountControllerTest.php b/tests/Feature/Controllers/Budget/AmountControllerTest.phpindex 3e37426ae3..e652504a66 100644--- a/tests/Feature/Controllers/Budget/AmountControllerTest.php+++ b/tests/Feature/Controllers/Budget/AmountControllerTest.php@@ -159,9 +159,9 @@ class AmountControllerTest extends TestCase$collector->shouldReceive('withOpposingAccount')->andReturnSelf()->times(2);// collect transactions to return. First an expense, then income.- $income = new Transaction;- $income->transaction_amount = '150';- $incomeCollection = new Collection([$income]);+ $income = new Transaction;+ $income->transaction_amount = '150';+ $incomeCollection = new Collection([$income]);$expense = new Transaction;$expense->transaction_amount = '100';$expenseCollection = new Collection([$expense]);@@ -169,7 +169,6 @@ class AmountControllerTest extends TestCase$collector->shouldReceive('getTransactions')->andReturn($incomeCollection, $expenseCollection)->times(2);-$repository->shouldReceive('getAvailableBudget')->andReturn('100.123');$accountRepos->shouldReceive('setUser');$accountRepos->shouldReceive('getAccountsByType')->andReturn(new Collection);@@ -181,15 +180,22 @@ class AmountControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Budget\AmountController+ * @covers \FireflyIII\Http\Controllers\Budget\AmountController+ * @dataProvider dateRangeProvider+ *+ * @param string $range*/- public function testInfoIncomeInversed(): void+ public function testInfoIncomeExpanded(string $range): void{- Log::debug('Now in testInfoIncome()');+ Log::debug(sprintf('Now in testInfoIncomeExpanded(%s)', $range));// mock stuff$accountRepos = $this->mock(AccountRepositoryInterface::class);$repository = $this->mock(BudgetRepositoryInterface::class);$collector = $this->mock(TransactionCollectorInterface::class);+ $repository->shouldReceive('getAvailableBudget')->andReturn('100.123');+ $accountRepos->shouldReceive('setUser');+ $accountRepos->shouldReceive('getAccountsByType')->andReturn(new Collection);+ $repository->shouldReceive('getAverageAvailable')->andReturn('100.123')->once();$collector->shouldReceive('setAllAssetAccounts')->andReturnSelf()->times(2);$collector->shouldReceive('setRange')->andReturnSelf()->times(2);@@ -197,44 +203,31 @@ class AmountControllerTest extends TestCase$collector->shouldReceive('withOpposingAccount')->andReturnSelf()->times(2);// collect transactions to return. First an expense, then income.- $income = new Transaction;- $income->transaction_amount = '100';- $incomeCollection = new Collection([$income]);+ $income = new Transaction;+ $income->transaction_amount = '150';+ $incomeCollection = new Collection([$income]);$expense = new Transaction;- $expense->transaction_amount = '150';+ $expense->transaction_amount = '100';$expenseCollection = new Collection([$expense]);$collector->shouldReceive('getTransactions')->andReturn($incomeCollection, $expenseCollection)->times(2);--- $repository->shouldReceive('getAvailableBudget')->andReturn('100.123');- $accountRepos->shouldReceive('setUser');- $accountRepos->shouldReceive('getAccountsByType')->andReturn(new Collection);- $repository->shouldReceive('getAverageAvailable')->andReturn('100.123')->once();-$this->be($this->user());- $response = $this->get(route('budgets.income.info', ['20170101', '20170131']));+ $this->changeDateRange($this->user(), $range);+ $response = $this->get(route('budgets.income.info', ['20170301', '20170430']));$response->assertStatus(200);}/**- * @covers \FireflyIII\Http\Controllers\Budget\AmountController- * @dataProvider dateRangeProvider- *- * @param string $range+ * @covers \FireflyIII\Http\Controllers\Budget\AmountController*/- public function testInfoIncomeExpanded(string $range): void+ public function testInfoIncomeInversed(): void{- Log::debug(sprintf('Now in testInfoIncomeExpanded(%s)', $range));+ Log::debug('Now in testInfoIncome()');// mock stuff$accountRepos = $this->mock(AccountRepositoryInterface::class);$repository = $this->mock(BudgetRepositoryInterface::class);$collector = $this->mock(TransactionCollectorInterface::class);- $repository->shouldReceive('getAvailableBudget')->andReturn('100.123');- $accountRepos->shouldReceive('setUser');- $accountRepos->shouldReceive('getAccountsByType')->andReturn(new Collection);- $repository->shouldReceive('getAverageAvailable')->andReturn('100.123')->once();$collector->shouldReceive('setAllAssetAccounts')->andReturnSelf()->times(2);$collector->shouldReceive('setRange')->andReturnSelf()->times(2);@@ -242,22 +235,26 @@ class AmountControllerTest extends TestCase$collector->shouldReceive('withOpposingAccount')->andReturnSelf()->times(2);// collect transactions to return. First an expense, then income.- $income = new Transaction;- $income->transaction_amount = '150';- $incomeCollection = new Collection([$income]);+ $income = new Transaction;+ $income->transaction_amount = '100';+ $incomeCollection = new Collection([$income]);$expense = new Transaction;- $expense->transaction_amount = '100';+ $expense->transaction_amount = '150';$expenseCollection = new Collection([$expense]);$collector->shouldReceive('getTransactions')->andReturn($incomeCollection, $expenseCollection)->times(2);++ $repository->shouldReceive('getAvailableBudget')->andReturn('100.123');+ $accountRepos->shouldReceive('setUser');+ $accountRepos->shouldReceive('getAccountsByType')->andReturn(new Collection);+ $repository->shouldReceive('getAverageAvailable')->andReturn('100.123')->once();+$this->be($this->user());- $this->changeDateRange($this->user(), $range);- $response = $this->get(route('budgets.income.info', ['20170301', '20170430']));+ $response = $this->get(route('budgets.income.info', ['20170101', '20170131']));$response->assertStatus(200);}-/*** @covers \FireflyIII\Http\Controllers\Budget\AmountController*/diff --git a/tests/Feature/Controllers/Chart/AccountControllerTest.php b/tests/Feature/Controllers/Chart/AccountControllerTest.phpindex ed19726000..90d1048b98 100644--- a/tests/Feature/Controllers/Chart/AccountControllerTest.php+++ b/tests/Feature/Controllers/Chart/AccountControllerTest.php@@ -49,7 +49,7 @@ class AccountControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/Chart/BillControllerTest.php b/tests/Feature/Controllers/Chart/BillControllerTest.phpindex 62c6324314..918d949843 100644--- a/tests/Feature/Controllers/Chart/BillControllerTest.php+++ b/tests/Feature/Controllers/Chart/BillControllerTest.php@@ -40,10 +40,10 @@ class BillControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();- Log::debug('Now in Feature/Controllers/Chart/Test.');+ Log::debug(sprintf('Now in %s.', \get_class($this)));}/**diff --git a/tests/Feature/Controllers/Chart/BudgetControllerTest.php b/tests/Feature/Controllers/Chart/BudgetControllerTest.phpindex ec89c0d65b..c049a3f990 100644--- a/tests/Feature/Controllers/Chart/BudgetControllerTest.php+++ b/tests/Feature/Controllers/Chart/BudgetControllerTest.php@@ -46,10 +46,10 @@ class BudgetControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();- Log::debug('Now in Feature/Controllers/Chart/Test.');+ Log::debug(sprintf('Now in %s.', \get_class($this)));}/**diff --git a/tests/Feature/Controllers/Chart/BudgetReportControllerTest.php b/tests/Feature/Controllers/Chart/BudgetReportControllerTest.phpindex e081ad8fe1..62dd0dbe31 100644--- a/tests/Feature/Controllers/Chart/BudgetReportControllerTest.php+++ b/tests/Feature/Controllers/Chart/BudgetReportControllerTest.php@@ -45,7 +45,7 @@ class BudgetReportControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/Chart/CategoryControllerTest.php b/tests/Feature/Controllers/Chart/CategoryControllerTest.phpindex db0fa81ef4..f15c33c92f 100644--- a/tests/Feature/Controllers/Chart/CategoryControllerTest.php+++ b/tests/Feature/Controllers/Chart/CategoryControllerTest.php@@ -42,7 +42,7 @@ class CategoryControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/Chart/CategoryReportControllerTest.php b/tests/Feature/Controllers/Chart/CategoryReportControllerTest.phpindex 1f360017ba..0d1c8665d2 100644--- a/tests/Feature/Controllers/Chart/CategoryReportControllerTest.php+++ b/tests/Feature/Controllers/Chart/CategoryReportControllerTest.php@@ -42,7 +42,7 @@ class CategoryReportControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/Chart/ExpenseReportControllerTest.php b/tests/Feature/Controllers/Chart/ExpenseReportControllerTest.phpindex f66588b8f0..9450875577 100644--- a/tests/Feature/Controllers/Chart/ExpenseReportControllerTest.php+++ b/tests/Feature/Controllers/Chart/ExpenseReportControllerTest.php@@ -39,7 +39,7 @@ class ExpenseReportControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/Chart/PiggyBankControllerTest.php b/tests/Feature/Controllers/Chart/PiggyBankControllerTest.phpindex 5ce714c013..2eff8eeb62 100644--- a/tests/Feature/Controllers/Chart/PiggyBankControllerTest.php+++ b/tests/Feature/Controllers/Chart/PiggyBankControllerTest.php@@ -37,7 +37,7 @@ class PiggyBankControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/Chart/ReportControllerTest.php b/tests/Feature/Controllers/Chart/ReportControllerTest.phpindex 31e7b92d99..ce432479b4 100644--- a/tests/Feature/Controllers/Chart/ReportControllerTest.php+++ b/tests/Feature/Controllers/Chart/ReportControllerTest.php@@ -26,9 +26,10 @@ use FireflyIII\Generator\Chart\Basic\GeneratorInterface;use FireflyIII\Repositories\Account\AccountRepositoryInterface;use FireflyIII\Repositories\Account\AccountTaskerInterface;use Log;+use Mockery;use Steam;use Tests\TestCase;-use Mockery;+/*** Class ReportControllerTest*/@@ -37,7 +38,7 @@ class ReportControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));@@ -55,7 +56,7 @@ class ReportControllerTest extends TestCase$accountRepos->shouldReceive('setUser');$accountRepos->shouldReceive('getMetaValue')->times(2)- ->withArgs([Mockery::any(), 'include_net_worth'])->andReturn('1','0');+ ->withArgs([Mockery::any(), 'include_net_worth'])->andReturn('1', '0');$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'currency_id'])->andReturn(1);$accountRepos->shouldReceive('getMetaValue')diff --git a/tests/Feature/Controllers/Chart/TagReportControllerTest.php b/tests/Feature/Controllers/Chart/TagReportControllerTest.phpindex 32df898d3f..e576963ec7 100644--- a/tests/Feature/Controllers/Chart/TagReportControllerTest.php+++ b/tests/Feature/Controllers/Chart/TagReportControllerTest.php@@ -46,7 +46,7 @@ class TagReportControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/CurrencyControllerTest.php b/tests/Feature/Controllers/CurrencyControllerTest.phpindex b07f20ebeb..0011b0885a 100644--- a/tests/Feature/Controllers/CurrencyControllerTest.php+++ b/tests/Feature/Controllers/CurrencyControllerTest.php@@ -45,7 +45,7 @@ class CurrencyControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));@@ -314,7 +314,7 @@ class CurrencyControllerTest extends TestCase$this->be($this->user());$response = $this->post(route('currencies.store'), $data);$response->assertStatus(302);- $response->assertSessionHas('error','Could not store the new currency.');+ $response->assertSessionHas('error', 'Could not store the new currency.');}/**diff --git a/tests/Feature/Controllers/DebugControllerTest.php b/tests/Feature/Controllers/DebugControllerTest.phpindex d0aaec92c2..97b8c54921 100644--- a/tests/Feature/Controllers/DebugControllerTest.php+++ b/tests/Feature/Controllers/DebugControllerTest.php@@ -39,7 +39,7 @@ class DebugControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/ExportControllerTest.php b/tests/Feature/Controllers/ExportControllerTest.phpindex 6a9fd06bc2..811edad167 100644--- a/tests/Feature/Controllers/ExportControllerTest.php+++ b/tests/Feature/Controllers/ExportControllerTest.php@@ -46,7 +46,7 @@ class ExportControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/HelpControllerTest.php b/tests/Feature/Controllers/HelpControllerTest.phpindex 345984fc98..0647a4963c 100644--- a/tests/Feature/Controllers/HelpControllerTest.php+++ b/tests/Feature/Controllers/HelpControllerTest.php@@ -39,7 +39,7 @@ class HelpControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/HomeControllerTest.php b/tests/Feature/Controllers/HomeControllerTest.phpindex 4a5bac9636..3eae28dda3 100644--- a/tests/Feature/Controllers/HomeControllerTest.php+++ b/tests/Feature/Controllers/HomeControllerTest.php@@ -48,7 +48,7 @@ class HomeControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/Import/CallbackControllerTest.php b/tests/Feature/Controllers/Import/CallbackControllerTest.phpindex 12788d9f65..5ef759b7bb 100644--- a/tests/Feature/Controllers/Import/CallbackControllerTest.php+++ b/tests/Feature/Controllers/Import/CallbackControllerTest.php@@ -26,9 +26,9 @@ namespace Tests\Feature\Controllers\Import;use FireflyIII\Models\ImportJob;use FireflyIII\Repositories\ImportJob\ImportJobRepositoryInterface;-use Tests\TestCase;use Log;use Mockery;+use Tests\TestCase;/***@@ -48,11 +48,12 @@ class CallbackControllerTest extends TestCase/*** @covers \FireflyIII\Http\Controllers\Import\CallbackController*/- public function testYnabBasic(): void {+ public function testYnabBasic(): void+ {$repository = $this->mock(ImportJobRepositoryInterface::class);// config for job:- $config = [];+ $config = [];$newConfig = ['auth_code' => 'abc'];// mock calls.@@ -72,7 +73,8 @@ class CallbackControllerTest extends TestCase/*** @covers \FireflyIII\Http\Controllers\Import\CallbackController*/- public function testYnabBasicBadJob(): void {+ public function testYnabBasicBadJob(): void+ {$repository = $this->mock(ImportJobRepositoryInterface::class);// mock calls.@@ -87,11 +89,12 @@ class CallbackControllerTest extends TestCase/*** @covers \FireflyIII\Http\Controllers\Import\CallbackController*/- public function testYnabBasicNoCode(): void {+ public function testYnabBasicNoCode(): void+ {$repository = $this->mock(ImportJobRepositoryInterface::class);// config for job:- $config = [];+ $config = [];$newConfig = ['auth_code' => 'abc'];// mock calls.diff --git a/tests/Feature/Controllers/Import/IndexControllerTest.php b/tests/Feature/Controllers/Import/IndexControllerTest.phpindex 58e936878e..d73fda83a6 100644--- a/tests/Feature/Controllers/Import/IndexControllerTest.php+++ b/tests/Feature/Controllers/Import/IndexControllerTest.php@@ -46,7 +46,7 @@ class IndexControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/Import/JobConfigurationControllerTest.php b/tests/Feature/Controllers/Import/JobConfigurationControllerTest.phpindex b004e39c22..5d70ab1f15 100644--- a/tests/Feature/Controllers/Import/JobConfigurationControllerTest.php+++ b/tests/Feature/Controllers/Import/JobConfigurationControllerTest.php@@ -40,7 +40,7 @@ class JobConfigurationControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/Import/JobStatusControllerTest.php b/tests/Feature/Controllers/Import/JobStatusControllerTest.phpindex fac1f6ac8b..ffc6a9597b 100644--- a/tests/Feature/Controllers/Import/JobStatusControllerTest.php+++ b/tests/Feature/Controllers/Import/JobStatusControllerTest.php@@ -45,7 +45,7 @@ class JobStatusControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/JavascriptControllerTest.php b/tests/Feature/Controllers/JavascriptControllerTest.phpindex cef17d124c..cc7eace7b1 100644--- a/tests/Feature/Controllers/JavascriptControllerTest.php+++ b/tests/Feature/Controllers/JavascriptControllerTest.php@@ -45,7 +45,7 @@ class JavascriptControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));@@ -62,7 +62,9 @@ class JavascriptControllerTest extends TestCase$account = factory(Account::class)->make();$accountRepos->shouldReceive('getAccountsByType')->andReturn(new Collection([$account]))- ->withArgs([[AccountType::DEFAULT, AccountType::ASSET, AccountType::DEBT,AccountType::LOAN,AccountType::MORTGAGE, AccountType::CREDITCARD]])->once();+ ->withArgs(+ [[AccountType::DEFAULT, AccountType::ASSET, AccountType::DEBT, AccountType::LOAN, AccountType::MORTGAGE, AccountType::CREDITCARD]]+ )->once();$currencyRepos->shouldReceive('findByCodeNull')->withArgs(['EUR'])->andReturn(new TransactionCurrency);$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'currency_id'])->andReturn('1');diff --git a/tests/Feature/Controllers/Json/AutoCompleteControllerTest.php b/tests/Feature/Controllers/Json/AutoCompleteControllerTest.phpindex 64b2397ca3..d20a3bb54b 100644--- a/tests/Feature/Controllers/Json/AutoCompleteControllerTest.php+++ b/tests/Feature/Controllers/Json/AutoCompleteControllerTest.php@@ -52,7 +52,7 @@ class AutoCompleteControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/Json/BoxControllerTest.php b/tests/Feature/Controllers/Json/BoxControllerTest.phpindex 8195a55ea4..65961f4f07 100644--- a/tests/Feature/Controllers/Json/BoxControllerTest.php+++ b/tests/Feature/Controllers/Json/BoxControllerTest.php@@ -44,7 +44,7 @@ class BoxControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));@@ -185,7 +185,7 @@ class BoxControllerTest extends TestCase/*** @covers \FireflyIII\Http\Controllers\Json\BoxController*/- public function testNetWorthNoInclude(): void+ public function testNetWorthFuture(): void{$result = [[@@ -194,20 +194,24 @@ class BoxControllerTest extends TestCase],];+ $accountRepos = $this->mock(AccountRepositoryInterface::class);+ $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);$netWorthHelper = $this->mock(NetWorthInterface::class);$netWorthHelper->shouldReceive('setUser')->once();$netWorthHelper->shouldReceive('getNetWorthByCurrency')->once()->andReturn($result);- $accountRepos = $this->mock(AccountRepositoryInterface::class);- $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);$accountRepos->shouldReceive('getActiveAccountsByType')->andReturn(new Collection([$this->user()->accounts()->first()]));$currencyRepos->shouldReceive('findNull')->andReturn(TransactionCurrency::find(1));$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'currency_id'])->andReturn('1');$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'accountRole'])->andReturn('ccAsset');- $accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'include_net_worth'])->andReturn('0');-+ $accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'include_net_worth'])->andReturn('1');+ $start = new Carbon;+ $start->addMonths(6)->startOfMonth();+ $end = clone $start;+ $end->endOfMonth();+ $this->session(['start' => $start, 'end' => $end]);$this->be($this->user());$response = $this->get(route('json.box.net-worth'));$response->assertStatus(200);@@ -216,7 +220,7 @@ class BoxControllerTest extends TestCase/*** @covers \FireflyIII\Http\Controllers\Json\BoxController*/- public function testNetWorthFuture(): void+ public function testNetWorthNoCurrency(): void{$result = [[@@ -233,16 +237,11 @@ class BoxControllerTest extends TestCase$netWorthHelper->shouldReceive('getNetWorthByCurrency')->once()->andReturn($result);$accountRepos->shouldReceive('getActiveAccountsByType')->andReturn(new Collection([$this->user()->accounts()->first()]));- $currencyRepos->shouldReceive('findNull')->andReturn(TransactionCurrency::find(1));+ $currencyRepos->shouldReceive('findNull')->andReturn(null);$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'currency_id'])->andReturn('1');$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'accountRole'])->andReturn('ccAsset');$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'include_net_worth'])->andReturn('1');- $start = new Carbon;- $start->addMonths(6)->startOfMonth();- $end = clone $start;- $end->endOfMonth();- $this->session(['start' => $start, 'end' => $end]);$this->be($this->user());$response = $this->get(route('json.box.net-worth'));$response->assertStatus(200);@@ -251,7 +250,7 @@ class BoxControllerTest extends TestCase/*** @covers \FireflyIII\Http\Controllers\Json\BoxController*/- public function testNetWorthNoCurrency(): void+ public function testNetWorthNoInclude(): void{$result = [[@@ -260,18 +259,19 @@ class BoxControllerTest extends TestCase],];- $accountRepos = $this->mock(AccountRepositoryInterface::class);- $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);$netWorthHelper = $this->mock(NetWorthInterface::class);$netWorthHelper->shouldReceive('setUser')->once();$netWorthHelper->shouldReceive('getNetWorthByCurrency')->once()->andReturn($result);+ $accountRepos = $this->mock(AccountRepositoryInterface::class);+ $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);$accountRepos->shouldReceive('getActiveAccountsByType')->andReturn(new Collection([$this->user()->accounts()->first()]));- $currencyRepos->shouldReceive('findNull')->andReturn(null);+ $currencyRepos->shouldReceive('findNull')->andReturn(TransactionCurrency::find(1));$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'currency_id'])->andReturn('1');$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'accountRole'])->andReturn('ccAsset');- $accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'include_net_worth'])->andReturn('1');+ $accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'include_net_worth'])->andReturn('0');+$this->be($this->user());$response = $this->get(route('json.box.net-worth'));diff --git a/tests/Feature/Controllers/Json/ExchangeControllerTest.php b/tests/Feature/Controllers/Json/ExchangeControllerTest.phpindex 2e083e8dc0..a3aa4a4da7 100644--- a/tests/Feature/Controllers/Json/ExchangeControllerTest.php+++ b/tests/Feature/Controllers/Json/ExchangeControllerTest.php@@ -40,7 +40,7 @@ class ExchangeControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));@@ -64,32 +64,32 @@ class ExchangeControllerTest extends TestCase/*** @covers \FireflyIII\Http\Controllers\Json\ExchangeController*/- public function testGetRateNull(): void+ public function testGetRateAmount(): void{$repository = $this->mock(CurrencyRepositoryInterface::class);-- $rate = factory(CurrencyExchangeRate::class)->make();- $repository->shouldReceive('getExchangeRate')->andReturnNull();- $interface = $this->mock(ExchangeRateInterface::class);- $interface->shouldReceive('setUser')->once();- $interface->shouldReceive('getRate')->andReturn($rate);+ $rate = factory(CurrencyExchangeRate::class)->make();+ $repository->shouldReceive('getExchangeRate')->andReturn($rate);$this->be($this->user());- $response = $this->get(route('json.rate', ['EUR', 'USD', '20170101']));+ $response = $this->get(route('json.rate', ['EUR', 'USD', '20170101']) . '?amount=10');$response->assertStatus(200);}/*** @covers \FireflyIII\Http\Controllers\Json\ExchangeController*/- public function testGetRateAmount(): void+ public function testGetRateNull(): void{$repository = $this->mock(CurrencyRepositoryInterface::class);- $rate = factory(CurrencyExchangeRate::class)->make();- $repository->shouldReceive('getExchangeRate')->andReturn($rate);++ $rate = factory(CurrencyExchangeRate::class)->make();+ $repository->shouldReceive('getExchangeRate')->andReturnNull();+ $interface = $this->mock(ExchangeRateInterface::class);+ $interface->shouldReceive('setUser')->once();+ $interface->shouldReceive('getRate')->andReturn($rate);$this->be($this->user());- $response = $this->get(route('json.rate', ['EUR', 'USD', '20170101']) . '?amount=10');+ $response = $this->get(route('json.rate', ['EUR', 'USD', '20170101']));$response->assertStatus(200);}}diff --git a/tests/Feature/Controllers/Json/FrontpageControllerTest.php b/tests/Feature/Controllers/Json/FrontpageControllerTest.phpindex 660bf97cd6..88c95fac14 100644--- a/tests/Feature/Controllers/Json/FrontpageControllerTest.php+++ b/tests/Feature/Controllers/Json/FrontpageControllerTest.php@@ -39,7 +39,7 @@ class FrontpageControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/Json/IntroControllerTest.php b/tests/Feature/Controllers/Json/IntroControllerTest.phpindex 0bb9c3d49b..95898309af 100644--- a/tests/Feature/Controllers/Json/IntroControllerTest.php+++ b/tests/Feature/Controllers/Json/IntroControllerTest.php@@ -37,7 +37,7 @@ class IntroControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/Json/ReconcileControllerTest.php b/tests/Feature/Controllers/Json/ReconcileControllerTest.phpindex 2e0a2601b3..7e24f87377 100644--- a/tests/Feature/Controllers/Json/ReconcileControllerTest.php+++ b/tests/Feature/Controllers/Json/ReconcileControllerTest.php@@ -41,7 +41,7 @@ class ReconcileControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/JsonControllerTest.php b/tests/Feature/Controllers/JsonControllerTest.phpindex 0e6501fcad..7432867f1f 100644--- a/tests/Feature/Controllers/JsonControllerTest.php+++ b/tests/Feature/Controllers/JsonControllerTest.php@@ -39,7 +39,7 @@ class JsonControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/NewUserControllerTest.php b/tests/Feature/Controllers/NewUserControllerTest.phpindex 103b04b4cf..9f210f6c78 100644--- a/tests/Feature/Controllers/NewUserControllerTest.php+++ b/tests/Feature/Controllers/NewUserControllerTest.php@@ -42,7 +42,7 @@ class NewUserControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/PiggyBankControllerTest.php b/tests/Feature/Controllers/PiggyBankControllerTest.phpindex ef6129b5c1..b93f53c098 100644--- a/tests/Feature/Controllers/PiggyBankControllerTest.php+++ b/tests/Feature/Controllers/PiggyBankControllerTest.php@@ -50,7 +50,7 @@ class PiggyBankControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/Popup/ReportControllerTest.php b/tests/Feature/Controllers/Popup/ReportControllerTest.phpindex a5fa7e294d..1ef29be399 100644--- a/tests/Feature/Controllers/Popup/ReportControllerTest.php+++ b/tests/Feature/Controllers/Popup/ReportControllerTest.php@@ -46,7 +46,7 @@ class ReportControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/PreferencesControllerTest.php b/tests/Feature/Controllers/PreferencesControllerTest.phpindex 29d5382b97..24e020ceff 100644--- a/tests/Feature/Controllers/PreferencesControllerTest.php+++ b/tests/Feature/Controllers/PreferencesControllerTest.php@@ -43,7 +43,7 @@ class PreferencesControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/ProfileControllerTest.php b/tests/Feature/Controllers/ProfileControllerTest.phpindex d525a9bc38..2f686cc0b4 100644--- a/tests/Feature/Controllers/ProfileControllerTest.php+++ b/tests/Feature/Controllers/ProfileControllerTest.php@@ -46,7 +46,7 @@ class ProfileControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/Report/AccountControllerTest.php b/tests/Feature/Controllers/Report/AccountControllerTest.phpindex 0cf176e38d..965ac4d6c4 100644--- a/tests/Feature/Controllers/Report/AccountControllerTest.php+++ b/tests/Feature/Controllers/Report/AccountControllerTest.php@@ -38,7 +38,7 @@ class AccountControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/Report/BalanceControllerTest.php b/tests/Feature/Controllers/Report/BalanceControllerTest.phpindex c41ea294c9..b6a124508c 100644--- a/tests/Feature/Controllers/Report/BalanceControllerTest.php+++ b/tests/Feature/Controllers/Report/BalanceControllerTest.php@@ -39,7 +39,7 @@ class BalanceControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/Report/BudgetControllerTest.php b/tests/Feature/Controllers/Report/BudgetControllerTest.phpindex 481a9b51be..308a0c487a 100644--- a/tests/Feature/Controllers/Report/BudgetControllerTest.php+++ b/tests/Feature/Controllers/Report/BudgetControllerTest.php@@ -40,7 +40,7 @@ class BudgetControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/Report/CategoryControllerTest.php b/tests/Feature/Controllers/Report/CategoryControllerTest.phpindex dc0a513d52..b230e00387 100644--- a/tests/Feature/Controllers/Report/CategoryControllerTest.php+++ b/tests/Feature/Controllers/Report/CategoryControllerTest.php@@ -40,7 +40,7 @@ class CategoryControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/Report/ExpenseControllerTest.php b/tests/Feature/Controllers/Report/ExpenseControllerTest.phpindex a00273a45f..77de4e78e2 100644--- a/tests/Feature/Controllers/Report/ExpenseControllerTest.php+++ b/tests/Feature/Controllers/Report/ExpenseControllerTest.php@@ -42,7 +42,7 @@ class ExpenseControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/Report/OperationsControllerTest.php b/tests/Feature/Controllers/Report/OperationsControllerTest.phpindex 3ecab0d1a0..afdcb13fb2 100644--- a/tests/Feature/Controllers/Report/OperationsControllerTest.php+++ b/tests/Feature/Controllers/Report/OperationsControllerTest.php@@ -38,7 +38,7 @@ class OperationsControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/ReportControllerTest.php b/tests/Feature/Controllers/ReportControllerTest.phpindex 38f6bf75a4..01559e3075 100644--- a/tests/Feature/Controllers/ReportControllerTest.php+++ b/tests/Feature/Controllers/ReportControllerTest.php@@ -56,7 +56,7 @@ class ReportControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));@@ -565,7 +565,7 @@ class ReportControllerTest extends TestCase$categoryRepos = $this->mock(CategoryRepositoryInterface::class);$tagRepos = $this->mock(TagRepositoryInterface::class);/** @var Tag $tag */- $tag = $this->user()->tags()->find(1);+ $tag = $this->user()->tags()->find(1);$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);$accountRepos->shouldReceive('findNull')->andReturn($this->user()->accounts()->find(1))->twice();$tagRepos->shouldReceive('findByTag')->andReturn($tag)->twice();diff --git a/tests/Feature/Controllers/Rule/CreateControllerTest.php b/tests/Feature/Controllers/Rule/CreateControllerTest.phpindex 22de7bb78d..62303792c1 100644--- a/tests/Feature/Controllers/Rule/CreateControllerTest.php+++ b/tests/Feature/Controllers/Rule/CreateControllerTest.php@@ -75,7 +75,7 @@ class CreateControllerTest extends TestCase$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);$this->be($this->user());- $response = $this->get(route('rules.create-from-bill', [1,1]));+ $response = $this->get(route('rules.create-from-bill', [1, 1]));$response->assertStatus(200);$response->assertSee('<ol class="breadcrumb">');}diff --git a/tests/Feature/Controllers/RuleGroupControllerTest.php b/tests/Feature/Controllers/RuleGroupControllerTest.phpindex 4a741bcc23..086809e696 100644--- a/tests/Feature/Controllers/RuleGroupControllerTest.php+++ b/tests/Feature/Controllers/RuleGroupControllerTest.php@@ -45,7 +45,7 @@ class RuleGroupControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/SearchControllerTest.php b/tests/Feature/Controllers/SearchControllerTest.phpindex 60930dee0b..f21132e69b 100644--- a/tests/Feature/Controllers/SearchControllerTest.php+++ b/tests/Feature/Controllers/SearchControllerTest.php@@ -39,7 +39,7 @@ class SearchControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/TagControllerTest.php b/tests/Feature/Controllers/TagControllerTest.phpindex ea21a4646c..f8eb171824 100644--- a/tests/Feature/Controllers/TagControllerTest.php+++ b/tests/Feature/Controllers/TagControllerTest.php@@ -45,7 +45,7 @@ class TagControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/Transaction/BulkControllerTest.php b/tests/Feature/Controllers/Transaction/BulkControllerTest.phpindex dfbd0710ba..1be187c0a0 100644--- a/tests/Feature/Controllers/Transaction/BulkControllerTest.php+++ b/tests/Feature/Controllers/Transaction/BulkControllerTest.php@@ -42,7 +42,7 @@ class BulkControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/Transaction/ConvertControllerTest.php b/tests/Feature/Controllers/Transaction/ConvertControllerTest.phpindex b397de2619..30e05b014d 100644--- a/tests/Feature/Controllers/Transaction/ConvertControllerTest.php+++ b/tests/Feature/Controllers/Transaction/ConvertControllerTest.php@@ -47,7 +47,7 @@ class ConvertControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));@@ -410,7 +410,7 @@ class ConvertControllerTest extends TestCasepublic function testPostIndexTransferDeposit(): void{// find transfer:- $transfer =$this->getRandomTransfer();+ $transfer = $this->getRandomTransfer();// mock stuff$repository = $this->mock(JournalRepositoryInterface::class);diff --git a/tests/Feature/Controllers/Transaction/MassControllerTest.php b/tests/Feature/Controllers/Transaction/MassControllerTest.phpindex 196d0514f7..c4e457626b 100644--- a/tests/Feature/Controllers/Transaction/MassControllerTest.php+++ b/tests/Feature/Controllers/Transaction/MassControllerTest.php@@ -43,7 +43,7 @@ class MassControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/Transaction/SingleControllerTest.php b/tests/Feature/Controllers/Transaction/SingleControllerTest.phpindex c9d8fa61e6..3c73122e9d 100644--- a/tests/Feature/Controllers/Transaction/SingleControllerTest.php+++ b/tests/Feature/Controllers/Transaction/SingleControllerTest.php@@ -57,7 +57,7 @@ class SingleControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/Transaction/SplitControllerTest.php b/tests/Feature/Controllers/Transaction/SplitControllerTest.phpindex e10dd064b9..f8c15229c4 100644--- a/tests/Feature/Controllers/Transaction/SplitControllerTest.php+++ b/tests/Feature/Controllers/Transaction/SplitControllerTest.php@@ -50,7 +50,7 @@ class SplitControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/Feature/Controllers/TransactionControllerTest.php b/tests/Feature/Controllers/TransactionControllerTest.phpindex 6e0516de89..b5a1038fee 100644--- a/tests/Feature/Controllers/TransactionControllerTest.php+++ b/tests/Feature/Controllers/TransactionControllerTest.php@@ -46,7 +46,7 @@ class TransactionControllerTest extends TestCase/****/- public function setUp()+ public function setUp(): void{parent::setUp();Log::debug(sprintf('Now in %s.', \get_class($this)));diff --git a/tests/TestCase.php b/tests/TestCase.phpindex f7f1a9f082..1192df583a 100644--- a/tests/TestCase.php+++ b/tests/TestCase.php@@ -119,6 +119,14 @@ abstract class TestCase extends BaseTestCasereturn $this->getRandomJournal(TransactionType::DEPOSIT);}+ /**+ * @return TransactionJournal+ */+ public function getRandomTransfer(): TransactionJournal+ {+ return $this->getRandomJournal(TransactionType::TRANSFER);+ }+/*** @return TransactionJournal*/@@ -128,11 +136,13 @@ abstract class TestCase extends BaseTestCase}/**- * @return TransactionJournal+ **/- public function getRandomTransfer(): TransactionJournal+ public function setUp(): void{- return $this->getRandomJournal(TransactionType::TRANSFER);+ parent::setUp();+ $repository = $this->mock(JournalRepositoryInterface::class);+ $repository->shouldReceive('firstNull')->andReturn(new TransactionJournal);}/**@@ -168,16 +178,6 @@ abstract class TestCase extends BaseTestCasereturn Mockery::mock('overload:' . $class);}- /**- *- */- protected function setUp(): void- {- parent::setUp();- $repository = $this->mock(JournalRepositoryInterface::class);- $repository->shouldReceive('firstNull')->andReturn(new TransactionJournal);- }-/*** @param string $type*diff --git a/tests/Unit/Factory/RecurrenceFactoryTest.php b/tests/Unit/Factory/RecurrenceFactoryTest.phpindex fd7a658a3e..46fe2592f6 100644--- a/tests/Unit/Factory/RecurrenceFactoryTest.php+++ b/tests/Unit/Factory/RecurrenceFactoryTest.php@@ -66,7 +66,7 @@ class RecurrenceFactoryTest extends TestCase$accountA = $this->user()->accounts()->inRandomOrder()->first();$accountB = $this->user()->accounts()->inRandomOrder()->first();$budget = $this->user()->budgets()->inRandomOrder()->first();- $category= $this->user()->categories()->inRandomOrder()->first();+ $category = $this->user()->categories()->inRandomOrder()->first();// mock other factories:$piggyFactory = $this->mock(PiggyBankFactory::class);@@ -160,7 +160,7 @@ class RecurrenceFactoryTest extends TestCase$accountA = $this->user()->accounts()->inRandomOrder()->first();$accountB = $this->user()->accounts()->inRandomOrder()->first();$budget = $this->user()->budgets()->inRandomOrder()->first();- $category= $this->user()->categories()->inRandomOrder()->first();+ $category = $this->user()->categories()->inRandomOrder()->first();// mock other factories:$piggyFactory = $this->mock(PiggyBankFactory::class);@@ -187,7 +187,7 @@ class RecurrenceFactoryTest extends TestCase$categoryFactory->shouldReceive('findOrCreate')->withArgs([2, 'Some category'])->once()->andReturn($category);// data for basic recurrence.- $data = [+ $data = ['recurrence' => ['type' => 'deposit','first_date' => Carbon::create()->addDay(),@@ -244,19 +244,19 @@ class RecurrenceFactoryTest extends TestCase}/**- * Deposit. With piggy bank. With tags. With budget. With category.+ * No piggy bank. With tags. With budget. With category.** @covers \FireflyIII\Factory\RecurrenceFactory* @covers \FireflyIII\Services\Internal\Support\RecurringTransactionTrait*/- public function testBasicTransfer(): void+ public function testBasicNoPiggybank(): void{// objects to return:$piggyBank = $this->user()->piggyBanks()->inRandomOrder()->first();$accountA = $this->user()->accounts()->inRandomOrder()->first();$accountB = $this->user()->accounts()->inRandomOrder()->first();$budget = $this->user()->budgets()->inRandomOrder()->first();- $category= $this->user()->categories()->inRandomOrder()->first();+ $category = $this->user()->categories()->inRandomOrder()->first();// mock other factories:$piggyFactory = $this->mock(PiggyBankFactory::class);@@ -268,7 +268,7 @@ class RecurrenceFactoryTest extends TestCase// mock calls:Amount::shouldReceive('getDefaultCurrencyByUser')->andReturn(TransactionCurrency::find(1))->once();$piggyFactory->shouldReceive('setUser')->once();- $piggyFactory->shouldReceive('find')->withArgs([1, 'Bla bla'])->andReturn($piggyBank);+ $piggyFactory->shouldReceive('find')->withArgs([1, 'Bla bla'])->andReturn(null);$accountRepos->shouldReceive('setUser')->twice();$accountRepos->shouldReceive('findNull')->twice()->andReturn($accountA, $accountB);@@ -285,7 +285,7 @@ class RecurrenceFactoryTest extends TestCase// data for basic recurrence.$data = ['recurrence' => [- 'type' => 'transfer',+ 'type' => 'withdrawal','first_date' => Carbon::create()->addDay(),'repetitions' => 0,'title' => 'Test recurrence' . random_int(1, 100000),@@ -328,10 +328,8 @@ class RecurrenceFactoryTest extends TestCase],],];-$typeFactory = $this->mock(TransactionTypeFactory::class);- $typeFactory->shouldReceive('find')->once()->withArgs([ucfirst($data['recurrence']['type'])])->andReturn(TransactionType::find(3));-+ $typeFactory->shouldReceive('find')->once()->withArgs([ucfirst($data['recurrence']['type'])])->andReturn(TransactionType::find(1));$factory = new RecurrenceFactory;$factory->setUser($this->user());@@ -352,7 +350,7 @@ class RecurrenceFactoryTest extends TestCase$accountA = $this->user()->accounts()->inRandomOrder()->first();$accountB = $this->user()->accounts()->inRandomOrder()->first();$budget = $this->user()->budgets()->inRandomOrder()->first();- $category= $this->user()->categories()->inRandomOrder()->first();+ $category = $this->user()->categories()->inRandomOrder()->first();// mock other factories:$piggyFactory = $this->mock(PiggyBankFactory::class);@@ -434,19 +432,19 @@ class RecurrenceFactoryTest extends TestCase}/**- * No piggy bank. With tags. With budget. With category.+ * Deposit. With piggy bank. With tags. With budget. With category.** @covers \FireflyIII\Factory\RecurrenceFactory* @covers \FireflyIII\Services\Internal\Support\RecurringTransactionTrait*/- public function testBasicNoPiggybank(): void+ public function testBasicTransfer(): void{// objects to return:$piggyBank = $this->user()->piggyBanks()->inRandomOrder()->first();$accountA = $this->user()->accounts()->inRandomOrder()->first();$accountB = $this->user()->accounts()->inRandomOrder()->first();$budget = $this->user()->budgets()->inRandomOrder()->first();- $category= $this->user()->categories()->inRandomOrder()->first();+ $category = $this->user()->categories()->inRandomOrder()->first();// mock other factories:$piggyFactory = $this->mock(PiggyBankFactory::class);@@ -458,7 +456,7 @@ class RecurrenceFactoryTest extends TestCase// mock calls:Amount::shouldReceive('getDefaultCurrencyByUser')->andReturn(TransactionCurrency::find(1))->once();$piggyFactory->shouldReceive('setUser')->once();- $piggyFactory->shouldReceive('find')->withArgs([1, 'Bla bla'])->andReturn(null);+ $piggyFactory->shouldReceive('find')->withArgs([1, 'Bla bla'])->andReturn($piggyBank);$accountRepos->shouldReceive('setUser')->twice();$accountRepos->shouldReceive('findNull')->twice()->andReturn($accountA, $accountB);@@ -473,9 +471,9 @@ class RecurrenceFactoryTest extends TestCase$categoryFactory->shouldReceive('findOrCreate')->withArgs([2, 'Some category'])->once()->andReturn($category);// data for basic recurrence.- $data = [+ $data = ['recurrence' => [- 'type' => 'withdrawal',+ 'type' => 'transfer','first_date' => Carbon::create()->addDay(),'repetitions' => 0,'title' => 'Test recurrence' . random_int(1, 100000),@@ -518,8 +516,10 @@ class RecurrenceFactoryTest extends TestCase],],];+$typeFactory = $this->mock(TransactionTypeFactory::class);- $typeFactory->shouldReceive('find')->once()->withArgs([ucfirst($data['recurrence']['type'])])->andReturn(TransactionType::find(1));+ $typeFactory->shouldReceive('find')->once()->withArgs([ucfirst($data['recurrence']['type'])])->andReturn(TransactionType::find(3));+$factory = new RecurrenceFactory;$factory->setUser($this->user());diff --git a/tests/Unit/Factory/TransactionFactoryTest.php b/tests/Unit/Factory/TransactionFactoryTest.phpindex f4e8a88e32..ec09a76624 100644--- a/tests/Unit/Factory/TransactionFactoryTest.php+++ b/tests/Unit/Factory/TransactionFactoryTest.php@@ -987,9 +987,9 @@ class TransactionFactoryTest extends TestCasepublic function testCreatePairSameBadType(): void{// objects:- $expense = $this->user()->accounts()->where('account_type_id', 4)->first();+ $expense = $this->user()->accounts()->where('account_type_id', 4)->first();$revenue = $this->user()->accounts()->where('account_type_id', 5)->first();- $euro = TransactionCurrency::first();+ $euro = TransactionCurrency::first();// mocked classes$accountRepos = $this->mock(AccountRepositoryInterface::class);diff --git a/tests/Unit/Factory/TransactionJournalFactoryTest.php b/tests/Unit/Factory/TransactionJournalFactoryTest.phpindex bf3109fa0b..4493a97bb3 100644--- a/tests/Unit/Factory/TransactionJournalFactoryTest.php+++ b/tests/Unit/Factory/TransactionJournalFactoryTest.php@@ -163,7 +163,7 @@ class TransactionJournalFactoryTest extends TestCase'transactions' => [['amount' => '',- ]+ ],],];diff --git a/tests/Unit/Factory/TransactionTypeFactoryTest.php b/tests/Unit/Factory/TransactionTypeFactoryTest.phpindex fbc3d7a457..7d65d5ed76 100644--- a/tests/Unit/Factory/TransactionTypeFactoryTest.php+++ b/tests/Unit/Factory/TransactionTypeFactoryTest.php@@ -54,7 +54,7 @@ class TransactionTypeFactoryTest extends TestCase/** @var TransactionTypeFactory $factory */$factory = app(TransactionTypeFactory::class);- $result = $factory->find($type->type);+ $result = $factory->find($type->type);$this->assertEquals($result->id, $type->id);}diff --git a/tests/Unit/Generator/Chart/Basic/ChartJsGeneratorTest.php b/tests/Unit/Generator/Chart/Basic/ChartJsGeneratorTest.phpindex 9184b02c94..febac12183 100644--- a/tests/Unit/Generator/Chart/Basic/ChartJsGeneratorTest.php+++ b/tests/Unit/Generator/Chart/Basic/ChartJsGeneratorTest.php@@ -95,18 +95,18 @@ class ChartJsGeneratorTest extends TestCase/*** @covers \FireflyIII\Generator\Chart\Basic\ChartJsGenerator*/- public function testPieChart(): void+ public function testMultiCurrencyPieChart(): void{$data = [- 'one' => -1,- 'two' => -2,- 'three' => -3,+ 'one' => ['amount' => -1, 'currency_symbol' => 'a'],+ 'two' => ['amount' => -2, 'currency_symbol' => 'b'],+ 'three' => ['amount' => -3, 'currency_symbol' => 'c'],];/** @var ChartJsGenerator $generator */$generator = new ChartJsGenerator();- $result = $generator->pieChart($data);+ $result = $generator->multiCurrencyPieChart($data);$this->assertEquals('three', $result['labels'][0]);$this->assertEquals(3.0, $result['datasets'][0]['data'][0]);@@ -116,13 +116,13 @@ class ChartJsGeneratorTest extends TestCase/*** @covers \FireflyIII\Generator\Chart\Basic\ChartJsGenerator*/- public function testMultiCurrencyPieChart(): void+ public function testMultiCurrencyPieChartPositive(): void{$data = [- 'one' => ['amount' => -1,'currency_symbol' => 'a'],- 'two' => ['amount' => -2,'currency_symbol' => 'b'],- 'three' => ['amount' => -3,'currency_symbol' => 'c'],+ 'one' => ['amount' => 1, 'currency_symbol' => 'a'],+ 'two' => ['amount' => 2, 'currency_symbol' => 'b'],+ 'three' => ['amount' => 3, 'currency_symbol' => 'c'],];/** @var ChartJsGenerator $generator */@@ -137,18 +137,18 @@ class ChartJsGeneratorTest extends TestCase/*** @covers \FireflyIII\Generator\Chart\Basic\ChartJsGenerator*/- public function testMultiCurrencyPieChartPositive(): void+ public function testPieChart(): void{$data = [- 'one' => ['amount' => 1,'currency_symbol' => 'a'],- 'two' => ['amount' => 2,'currency_symbol' => 'b'],- 'three' => ['amount' => 3,'currency_symbol' => 'c'],+ 'one' => -1,+ 'two' => -2,+ 'three' => -3,];/** @var ChartJsGenerator $generator */$generator = new ChartJsGenerator();- $result = $generator->multiCurrencyPieChart($data);+ $result = $generator->pieChart($data);$this->assertEquals('three', $result['labels'][0]);$this->assertEquals(3.0, $result['datasets'][0]['data'][0]);diff --git a/tests/Unit/Handlers/Events/AdminEventHandlerTest.php b/tests/Unit/Handlers/Events/AdminEventHandlerTest.phpindex 6515aa743b..b82bcd4c4a 100644--- a/tests/Unit/Handlers/Events/AdminEventHandlerTest.php+++ b/tests/Unit/Handlers/Events/AdminEventHandlerTest.php@@ -29,9 +29,10 @@ use FireflyIII\Handlers\Events\AdminEventHandler;use FireflyIII\Mail\AdminTestMail;use FireflyIII\Repositories\User\UserRepositoryInterface;use Illuminate\Support\Facades\Mail;+use Log;use Mockery;use Tests\TestCase;-use Log;+/*** Class AdminEventHandlerTest*/diff --git a/tests/Unit/Helpers/Attachments/AttachmentHelperTest.php b/tests/Unit/Helpers/Attachments/AttachmentHelperTest.phpindex 981ce3f85b..4daf52ac5c 100644--- a/tests/Unit/Helpers/Attachments/AttachmentHelperTest.php+++ b/tests/Unit/Helpers/Attachments/AttachmentHelperTest.php@@ -152,8 +152,8 @@ class AttachmentHelperTest extends TestCase// mock calls:Storage::fake('upload');- $path = public_path('browserconfig.xml');- $helper = new AttachmentHelper;+ $path = public_path('browserconfig.xml');+ $helper = new AttachmentHelper;// make new attachment:$journal = $this->user()->transactionJournals()->inRandomOrder()->first();diff --git a/tests/Unit/Helpers/Chart/MetaPieChartTest.php b/tests/Unit/Helpers/Chart/MetaPieChartTest.phpindex 5b44be9c61..45580a5335 100644--- a/tests/Unit/Helpers/Chart/MetaPieChartTest.php+++ b/tests/Unit/Helpers/Chart/MetaPieChartTest.php@@ -34,8 +34,8 @@ use FireflyIII\Models\Transaction;use FireflyIII\Models\TransactionType;use FireflyIII\Repositories\Account\AccountRepositoryInterface;use Illuminate\Support\Collection;-use Tests\TestCase;use Log;+use Tests\TestCase;/*** Class MetaPieChartTestdiff --git a/tests/Unit/Helpers/Help/HelpTest.php b/tests/Unit/Helpers/Help/HelpTest.phpindex 2c0f109473..292effbad3 100644--- a/tests/Unit/Helpers/Help/HelpTest.php+++ b/tests/Unit/Helpers/Help/HelpTest.php@@ -66,7 +66,7 @@ class HelpTest extends TestCase// now let's see what happens:$help = new Help;$result = $help->getFromGitHub('test-route', 'en_US');- $this->assertEquals('<p>Some help text.</p>'."\n", $result);+ $this->assertEquals('<p>Some help text.</p>' . "\n", $result);}/**diff --git a/tests/Unit/Middleware/AuthenticateTest.php b/tests/Unit/Middleware/AuthenticateTest.phpindex 844b5e6b1d..4a2c91fd38 100644--- a/tests/Unit/Middleware/AuthenticateTest.php+++ b/tests/Unit/Middleware/AuthenticateTest.php@@ -33,6 +33,20 @@ use Tests\TestCase;*/class AuthenticateTest extends TestCase{+ /**+ * Set up test+ */+ public function setUp(): void+ {+ parent::setUp();++ Route::middleware('auth')->any(+ '/_test/authenticate', function () {+ return 'OK';+ }+ );+ }+/*** @covers \FireflyIII\Http\Middleware\Authenticate*/@@ -98,18 +112,4 @@ class AuthenticateTest extends TestCase$response->assertSessionHas('logoutMessage', (string)trans('firefly.email_changed_logout'));$response->assertRedirect(route('login'));}-- /**- * Set up test- */- protected function setUp()- {- parent::setUp();-- Route::middleware('auth')->any(- '/_test/authenticate', function () {- return 'OK';- }- );- }}diff --git a/tests/Unit/Middleware/AuthenticateTwoFactorTest.php b/tests/Unit/Middleware/AuthenticateTwoFactorTest.phpindex 6db6e7f966..4e4912c4f2 100644--- a/tests/Unit/Middleware/AuthenticateTwoFactorTest.php+++ b/tests/Unit/Middleware/AuthenticateTwoFactorTest.php@@ -35,6 +35,20 @@ use Tests\TestCase;*/class AuthenticateTwoFactorTest extends TestCase{+ /**+ * Set up test+ */+ public function setUp(): void+ {+ parent::setUp();++ Route::middleware(AuthenticateTwoFactor::class)->any(+ '/_test/authenticate', function () {+ return 'OK';+ }+ );+ }+/*** @covers \FireflyIII\Http\Middleware\AuthenticateTwoFactor*/@@ -174,18 +188,4 @@ class AuthenticateTwoFactorTest extends TestCase$this->assertEquals(Response::HTTP_FOUND, $response->getStatusCode());$response->assertRedirect(route('two-factor.index'));}-- /**- * Set up test- */- protected function setUp()- {- parent::setUp();-- Route::middleware(AuthenticateTwoFactor::class)->any(- '/_test/authenticate', function () {- return 'OK';- }- );- }}diff --git a/tests/Unit/Middleware/IsAdminTest.php b/tests/Unit/Middleware/IsAdminTest.phpindex 0efc31ae7f..15e591062d 100644--- a/tests/Unit/Middleware/IsAdminTest.php+++ b/tests/Unit/Middleware/IsAdminTest.php@@ -33,6 +33,20 @@ use Tests\TestCase;*/class IsAdminTest extends TestCase{+ /**+ * Set up test+ */+ public function setUp(): void+ {+ parent::setUp();++ Route::middleware(IsAdmin::class)->any(+ '/_test/is-admin', function () {+ return 'OK';+ }+ );+ }+/*** @covers \FireflyIII\Http\Middleware\IsAdmin*/@@ -77,18 +91,4 @@ class IsAdminTest extends TestCase$response = $this->get('/_test/is-admin');$this->assertEquals(Response::HTTP_OK, $response->getStatusCode());}-- /**- * Set up test- */- protected function setUp()- {- parent::setUp();-- Route::middleware(IsAdmin::class)->any(- '/_test/is-admin', function () {- return 'OK';- }- );- }}diff --git a/tests/Unit/Middleware/IsDemoUserTest.php b/tests/Unit/Middleware/IsDemoUserTest.phpindex 2a56a6c7fa..9caeaaef7f 100644--- a/tests/Unit/Middleware/IsDemoUserTest.php+++ b/tests/Unit/Middleware/IsDemoUserTest.php@@ -34,6 +34,20 @@ use Tests\TestCase;*/class IsDemoUserTest extends TestCase{+ /**+ * Set up test+ */+ public function setUp(): void+ {+ parent::setUp();++ Route::middleware([StartFireflySession::class, IsDemoUser::class])->any(+ '/_test/is-demo', function () {+ return 'OK';+ }+ );+ }+/*** @covers \FireflyIII\Http\Middleware\IsDemoUser*/@@ -63,18 +77,4 @@ class IsDemoUserTest extends TestCase$response = $this->get('/_test/is-demo');$this->assertEquals(Response::HTTP_OK, $response->getStatusCode());}-- /**- * Set up test- */- protected function setUp()- {- parent::setUp();-- Route::middleware([StartFireflySession::class, IsDemoUser::class])->any(- '/_test/is-demo', function () {- return 'OK';- }- );- }}diff --git a/tests/Unit/Middleware/IsSandstormUserTest.php b/tests/Unit/Middleware/IsSandstormUserTest.phpindex 07420f464e..908a606212 100644--- a/tests/Unit/Middleware/IsSandstormUserTest.php+++ b/tests/Unit/Middleware/IsSandstormUserTest.php@@ -33,6 +33,20 @@ use Tests\TestCase;*/class IsSandstormUserTest extends TestCase{+ /**+ * Set up test+ */+ public function setUp(): void+ {+ parent::setUp();++ Route::middleware(IsSandStormUser::class)->any(+ '/_test/is-sandstorm', function () {+ return 'OK';+ }+ );+ }+/*** @covers \FireflyIII\Http\Middleware\IsSandStormUser*/@@ -69,18 +83,4 @@ class IsSandstormUserTest extends TestCase$response->assertRedirect(route('index'));putenv('SANDSTORM=0');}-- /**- * Set up test- */- protected function setUp()- {- parent::setUp();-- Route::middleware(IsSandStormUser::class)->any(- '/_test/is-sandstorm', function () {- return 'OK';- }- );- }}diff --git a/tests/Unit/Middleware/RangeTest.php b/tests/Unit/Middleware/RangeTest.phpindex 82302099b4..4d7131487e 100644--- a/tests/Unit/Middleware/RangeTest.php+++ b/tests/Unit/Middleware/RangeTest.php@@ -35,6 +35,20 @@ use Tests\TestCase;*/class RangeTest extends TestCase{+ /**+ * Set up test+ */+ public function setUp(): void+ {+ parent::setUp();++ Route::middleware(Range::class)->any(+ '/_test/range', function () {+ return view('test.test');+ }+ );+ }+/*** @covers \FireflyIII\Http\Middleware\Range*/@@ -62,18 +76,4 @@ class RangeTest extends TestCase$response = $this->get('/_test/range');$this->assertEquals(Response::HTTP_OK, $response->getStatusCode());}-- /**- * Set up test- */- protected function setUp()- {- parent::setUp();-- Route::middleware(Range::class)->any(- '/_test/range', function () {- return view('test.test');- }- );- }}diff --git a/tests/Unit/Middleware/RedirectIf2FAAuthenticatedTest.php b/tests/Unit/Middleware/RedirectIf2FAAuthenticatedTest.phpindex ea2b94a8ff..46f5701f9d 100644--- a/tests/Unit/Middleware/RedirectIf2FAAuthenticatedTest.php+++ b/tests/Unit/Middleware/RedirectIf2FAAuthenticatedTest.php@@ -35,6 +35,20 @@ use Tests\TestCase;*/class RedirectIf2FAAuthenticatedTest extends TestCase{+ /**+ * Set up test+ */+ public function setUp(): void+ {+ parent::setUp();++ Route::middleware(RedirectIfTwoFactorAuthenticated::class)->any(+ '/_test/authenticate', function () {+ return 'OK';+ }+ );+ }+/*** @covers \FireflyIII\Http\Middleware\RedirectIfTwoFactorAuthenticated*/@@ -77,18 +91,4 @@ class RedirectIf2FAAuthenticatedTest extends TestCase$response = $this->get('/_test/authenticate');$this->assertEquals(Response::HTTP_OK, $response->getStatusCode());}-- /**- * Set up test- */- protected function setUp()- {- parent::setUp();-- Route::middleware(RedirectIfTwoFactorAuthenticated::class)->any(- '/_test/authenticate', function () {- return 'OK';- }- );- }}diff --git a/tests/Unit/Middleware/RedirectIfAuthenticatedTest.php b/tests/Unit/Middleware/RedirectIfAuthenticatedTest.phpindex 976e8a1200..de208d2c30 100644--- a/tests/Unit/Middleware/RedirectIfAuthenticatedTest.php+++ b/tests/Unit/Middleware/RedirectIfAuthenticatedTest.php@@ -33,6 +33,20 @@ use Tests\TestCase;*/class RedirectIfAuthenticatedTest extends TestCase{+ /**+ * Set up test+ */+ public function setUp(): void+ {+ parent::setUp();++ Route::middleware(RedirectIfAuthenticated::class)->any(+ '/_test/authenticate', function () {+ return 'OK';+ }+ );+ }+/*** @covers \FireflyIII\Http\Middleware\RedirectIfAuthenticated*/@@ -52,18 +66,4 @@ class RedirectIfAuthenticatedTest extends TestCase$this->assertEquals(Response::HTTP_FOUND, $response->getStatusCode());$response->assertRedirect(route('index'));}-- /**- * Set up test- */- protected function setUp()- {- parent::setUp();-- Route::middleware(RedirectIfAuthenticated::class)->any(- '/_test/authenticate', function () {- return 'OK';- }- );- }}diff --git a/tests/Unit/Middleware/SandstormTest.php b/tests/Unit/Middleware/SandstormTest.phpindex 03432793d8..e37408f1e6 100644--- a/tests/Unit/Middleware/SandstormTest.php+++ b/tests/Unit/Middleware/SandstormTest.php@@ -35,6 +35,20 @@ use Tests\TestCase;*/class SandstormTest extends TestCase{+ /**+ * Set up test+ */+ public function setUp(): void+ {+ parent::setUp();++ Route::middleware(Sandstorm::class)->any(+ '/_test/sandstorm', function () {+ return view('test.test');+ }+ );+ }+/*** @covers \FireflyIII\Http\Middleware\Sandstorm*/@@ -56,18 +70,4 @@ class SandstormTest extends TestCaseputenv('SANDSTORM=0');}-- /**- * Set up test- */- protected function setUp(): void- {- parent::setUp();-- Route::middleware(Sandstorm::class)->any(- '/_test/sandstorm', function () {- return view('test.test');- }- );- }}diff --git a/tests/Unit/Support/Import/JobConfiguration/Bunq/ChooseAccountsHandlerTest.php b/tests/Unit/Support/Import/JobConfiguration/Bunq/ChooseAccountsHandlerTest.phpindex 0014f6a0ff..a17742f6ed 100644--- a/tests/Unit/Support/Import/JobConfiguration/Bunq/ChooseAccountsHandlerTest.php+++ b/tests/Unit/Support/Import/JobConfiguration/Bunq/ChooseAccountsHandlerTest.php@@ -193,7 +193,7 @@ class ChooseAccountsHandlerTest extends TestCase];$expected = $config;$expected['mapping'][0] = 456;- $expected['bunq-iban'] = [];+ $expected['bunq-iban'] = [];// mock stuff$repository = $this->mock(ImportJobRepositoryInterface::class);diff --git a/tests/Unit/TransactionRules/Triggers/CategoryIsTest.php b/tests/Unit/TransactionRules/Triggers/CategoryIsTest.phpindex c65ef7d4ae..00ffac19a3 100644--- a/tests/Unit/TransactionRules/Triggers/CategoryIsTest.php+++ b/tests/Unit/TransactionRules/Triggers/CategoryIsTest.php@@ -22,7 +22,6 @@ declare(strict_types=1);namespace Tests\Unit\TransactionRules\Triggers;-use FireflyIII\Models\TransactionJournal;use FireflyIII\TransactionRules\Triggers\CategoryIs;use Tests\TestCase;@@ -69,7 +68,7 @@ class CategoryIsTest extends TestCase*/public function testTriggeredTransaction(): void{- $withdrawal = $this->getRandomWithdrawal();+ $withdrawal = $this->getRandomWithdrawal();$transaction = $withdrawal->transactions()->first();$category = $withdrawal->user->categories()->first();diff --git a/tests/Unit/TransactionRules/Triggers/HasAnyBudgetTest.php b/tests/Unit/TransactionRules/Triggers/HasAnyBudgetTest.phpindex 71d015d1be..70b4535796 100644--- a/tests/Unit/TransactionRules/Triggers/HasAnyBudgetTest.php+++ b/tests/Unit/TransactionRules/Triggers/HasAnyBudgetTest.php@@ -23,7 +23,6 @@ declare(strict_types=1);namespace Tests\Unit\TransactionRules\Triggers;use FireflyIII\Models\Transaction;-use FireflyIII\Models\TransactionJournal;use FireflyIII\TransactionRules\Triggers\HasAnyBudget;use Log;use Tests\TestCase;diff --git a/tests/Unit/TransactionRules/Triggers/HasAttachmentTest.php b/tests/Unit/TransactionRules/Triggers/HasAttachmentTest.phpindex ab67f5551d..5d03a50776 100644--- a/tests/Unit/TransactionRules/Triggers/HasAttachmentTest.php+++ b/tests/Unit/TransactionRules/Triggers/HasAttachmentTest.php@@ -22,7 +22,6 @@ declare(strict_types=1);namespace Tests\Unit\TransactionRules\Triggers;-use FireflyIII\Models\TransactionJournal;use FireflyIII\TransactionRules\Triggers\HasAttachment;use Tests\TestCase;diff --git a/tests/Unit/TransactionRules/Triggers/HasNoCategoryTest.php b/tests/Unit/TransactionRules/Triggers/HasNoCategoryTest.phpindex 9f12927fd5..fb48439231 100644--- a/tests/Unit/TransactionRules/Triggers/HasNoCategoryTest.php+++ b/tests/Unit/TransactionRules/Triggers/HasNoCategoryTest.php@@ -75,7 +75,7 @@ class HasNoCategoryTest extends TestCase*/public function testTriggeredTransaction(): void{- $withdrawal = $this->getRandomWithdrawal();+ $withdrawal = $this->getRandomWithdrawal();$transaction = $withdrawal->transactions()->first();$category = $withdrawal->user->categories()->first();