diff --git a/tests/Api/V1/Controllers/AboutControllerTest.php b/tests/Api/V1/Controllers/AboutControllerTest.php
index 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.php
index 65bd2f7295..a37c12f2b7 100644
--- a/tests/Api/V1/Controllers/AvailableBudgetControllerTest.php
+++ b/tests/Api/V1/Controllers/AvailableBudgetControllerTest.php
@@ -148,6 +148,40 @@ class AvailableBudgetControllerTest extends TestCase
$response->assertHeader('Content-Type', 'application/vnd.api+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
+ {
+ // mock stuff:
+ $repository = $this->mock(BudgetRepositoryInterface::class);
+ $currencyRepository = $this->mock(CurrencyRepositoryInterface::class);
+
+ // mock calls:
+ $repository->shouldReceive('setUser')->once();
+ $currencyRepository->shouldReceive('findNull')->withArgs([1])->andReturn(null)->once();
+ $currencyRepository->shouldReceive('findByCodeNull')->withArgs(['EUR'])->andReturn(null)->once();
+
+ // data to submit
+ $data = [
+ 'currency_id' => '1',
+ 'currency_code' => 'EUR',
+ 'amount' => '100',
+ 'start_date' => '2018-01-01',
+ 'end_date' => '2018-01-31',
+ ];
+
+
+ // 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');
+ }
+
/**
* Store new available budget without a valid currency.
*
@@ -186,40 +220,6 @@ class AvailableBudgetControllerTest extends TestCase
$response->assertSee($availableBudget->amount); // the amount
$response->assertHeader('Content-Type', 'application/vnd.api+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
- {
- // mock stuff:
- $repository = $this->mock(BudgetRepositoryInterface::class);
- $currencyRepository = $this->mock(CurrencyRepositoryInterface::class);
-
- // mock calls:
- $repository->shouldReceive('setUser')->once();
- $currencyRepository->shouldReceive('findNull')->withArgs([1])->andReturn(null)->once();
- $currencyRepository->shouldReceive('findByCodeNull')->withArgs(['EUR'])->andReturn(null)->once();
-
- // data to submit
- $data = [
- 'currency_id' => '1',
- 'currency_code' => 'EUR',
- 'amount' => '100',
- 'start_date' => '2018-01-01',
- 'end_date' => '2018-01-31',
- ];
-
-
- // 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');
- }
-
/**
* Update available budget.
diff --git a/tests/Api/V1/Controllers/BillControllerTest.php b/tests/Api/V1/Controllers/BillControllerTest.php
index 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.php
index 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.php
index 86f195db9d..2f5dc9adee 100644
--- a/tests/Api/V1/Controllers/RuleControllerTest.php
+++ b/tests/Api/V1/Controllers/RuleControllerTest.php
@@ -142,6 +142,72 @@ class RuleControllerTest extends TestCase
}
+ /**
+ * @covers \FireflyIII\Api\V1\Controllers\RuleController
+ * @covers \FireflyIII\Api\V1\Requests\RuleRequest
+ */
+ public function testStoreNoActions(): void
+ {
+ $ruleRepos = $this->mock(RuleRepositoryInterface::class);
+ $ruleRepos->shouldReceive('setUser')->once();
+ $rule = $this->user()->rules()->first();
+ $data = [
+ 'title' => 'Store new rule',
+ 'rule_group_id' => 1,
+ 'trigger' => 'store-journal',
+ 'strict' => 1,
+ 'stop_processing' => 1,
+ 'active' => 1,
+ 'rule_triggers' => [
+ [
+ 'name' => 'description_is',
+ 'value' => 'Hello',
+ 'stop_processing' => 1,
+ ],
+ ],
+ 'rule_actions' => [
+ ],
+ ];
+
+ // test API
+ $response = $this->post('/api/v1/rules', $data, ['Accept' => 'application/json']);
+ $response->assertStatus(422);
+ }
+
+ /**
+ * @covers \FireflyIII\Api\V1\Controllers\RuleController
+ * @covers \FireflyIII\Api\V1\Requests\RuleRequest
+ */
+ public function testStoreNoTriggers(): void
+ {
+ $ruleRepos = $this->mock(RuleRepositoryInterface::class);
+ $ruleRepos->shouldReceive('setUser')->once();
+ $rule = $this->user()->rules()->first();
+ $data = [
+ 'title' => 'Store new rule',
+ 'rule_group_id' => 1,
+ 'trigger' => 'store-journal',
+ 'strict' => 1,
+ 'stop_processing' => 1,
+ 'active' => 1,
+ 'rule_triggers' => [
+ ],
+ 'rule_actions' => [
+ [
+ 'name' => 'add_tag',
+ 'value' => 'A',
+ 'stop_processing' => 1,
+ ],
+ ],
+ ];
+
+ // test API
+ $response = $this->post('/api/v1/rules', $data, ['Accept' => 'application/json']);
+ $response->assertStatus(422);
+ $response->assertSee('');
+
+ }
+
/**
* @covers \FireflyIII\Api\V1\Controllers\RuleController
* @covers \FireflyIII\Api\V1\Requests\RuleRequest
@@ -183,71 +249,4 @@ class RuleControllerTest extends TestCase
}
- /**
- * @covers \FireflyIII\Api\V1\Controllers\RuleController
- * @covers \FireflyIII\Api\V1\Requests\RuleRequest
- */
- public function testStoreNoTriggers(): void
- {
- $ruleRepos = $this->mock(RuleRepositoryInterface::class);
- $ruleRepos->shouldReceive('setUser')->once();
- $rule = $this->user()->rules()->first();
- $data = [
- 'title' => 'Store new rule',
- 'rule_group_id' => 1,
- 'trigger' => 'store-journal',
- 'strict' => 1,
- 'stop_processing' => 1,
- 'active' => 1,
- 'rule_triggers' => [
- ],
- 'rule_actions' => [
- [
- 'name' => 'add_tag',
- 'value' => 'A',
- 'stop_processing' => 1,
- ],
- ],
- ];
-
- // test API
- $response = $this->post('/api/v1/rules', $data, ['Accept' => 'application/json']);
- $response->assertStatus(422);
- $response->assertSee('');
-
- }
-
-
- /**
- * @covers \FireflyIII\Api\V1\Controllers\RuleController
- * @covers \FireflyIII\Api\V1\Requests\RuleRequest
- */
- public function testStoreNoActions(): void
- {
- $ruleRepos = $this->mock(RuleRepositoryInterface::class);
- $ruleRepos->shouldReceive('setUser')->once();
- $rule = $this->user()->rules()->first();
- $data = [
- 'title' => 'Store new rule',
- 'rule_group_id' => 1,
- 'trigger' => 'store-journal',
- 'strict' => 1,
- 'stop_processing' => 1,
- 'active' => 1,
- 'rule_triggers' => [
- [
- 'name' => 'description_is',
- 'value' => 'Hello',
- 'stop_processing' => 1,
- ],
- ],
- 'rule_actions' => [
- ],
- ];
-
- // test API
- $response = $this->post('/api/v1/rules', $data, ['Accept' => 'application/json']);
- $response->assertStatus(422);
- }
-
}
\ No newline at end of file
diff --git a/tests/Api/V1/Controllers/RuleGroupControllerTest.php b/tests/Api/V1/Controllers/RuleGroupControllerTest.php
index f77ea61029..c21b7785ab 100644
--- a/tests/Api/V1/Controllers/RuleGroupControllerTest.php
+++ b/tests/Api/V1/Controllers/RuleGroupControllerTest.php
@@ -90,7 +90,7 @@ class RuleGroupControllerTest extends TestCase
public 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.php
index 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.php
index 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('
');
}
- /**
- * @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.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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,45 +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);
- $repository->shouldReceive('getAverageAvailable')->andReturn('100.123')->once();
-
- $this->be($this->user());
- $response = $this->get(route('budgets.income.info', ['20170101', '20170131']));
- $response->assertStatus(200);
- }
-
- /**
- * @covers \FireflyIII\Http\Controllers\Budget\AmountController
- */
- public function testInfoIncomeInversed(): void
- {
- Log::debug('Now in testInfoIncome()');
- // mock stuff
- $accountRepos = $this->mock(AccountRepositoryInterface::class);
- $repository = $this->mock(BudgetRepositoryInterface::class);
- $collector = $this->mock(TransactionCollectorInterface::class);
-
- $collector->shouldReceive('setAllAssetAccounts')->andReturnSelf()->times(2);
- $collector->shouldReceive('setRange')->andReturnSelf()->times(2);
- $collector->shouldReceive('setTypes')->andReturnSelf()->times(2);
- $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]);
- $expense = new Transaction;
- $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);
@@ -242,9 +203,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]);
@@ -257,6 +218,42 @@ class AmountControllerTest extends TestCase
$response->assertStatus(200);
}
+ /**
+ * @covers \FireflyIII\Http\Controllers\Budget\AmountController
+ */
+ public function testInfoIncomeInversed(): void
+ {
+ Log::debug('Now in testInfoIncome()');
+ // mock stuff
+ $accountRepos = $this->mock(AccountRepositoryInterface::class);
+ $repository = $this->mock(BudgetRepositoryInterface::class);
+ $collector = $this->mock(TransactionCollectorInterface::class);
+
+ $collector->shouldReceive('setAllAssetAccounts')->andReturnSelf()->times(2);
+ $collector->shouldReceive('setRange')->andReturnSelf()->times(2);
+ $collector->shouldReceive('setTypes')->andReturnSelf()->times(2);
+ $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]);
+ $expense = new Transaction;
+ $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());
+ $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.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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)));
@@ -182,37 +182,6 @@ class BoxControllerTest extends TestCase
$response->assertStatus(200);
}
- /**
- * @covers \FireflyIII\Http\Controllers\Json\BoxController
- */
- public function testNetWorthNoInclude(): void
- {
- $result = [
- [
- 'currency' => TransactionCurrency::find(1),
- 'balance' => '3',
- ],
- ];
-
-
- $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');
-
-
- $this->be($this->user());
- $response = $this->get(route('json.box.net-worth'));
- $response->assertStatus(200);
- }
-
/**
* @covers \FireflyIII\Http\Controllers\Json\BoxController
*/
@@ -278,6 +247,37 @@ class BoxControllerTest extends TestCase
$response->assertStatus(200);
}
+ /**
+ * @covers \FireflyIII\Http\Controllers\Json\BoxController
+ */
+ public function testNetWorthNoInclude(): void
+ {
+ $result = [
+ [
+ 'currency' => TransactionCurrency::find(1),
+ 'balance' => '3',
+ ],
+ ];
+
+
+ $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');
+
+
+ $this->be($this->user());
+ $response = $this->get(route('json.box.net-worth'));
+ $response->assertStatus(200);
+ }
+
/**
* @covers \FireflyIII\Http\Controllers\Json\BoxController
*/
diff --git a/tests/Feature/Controllers/Json/ExchangeControllerTest.php b/tests/Feature/Controllers/Json/ExchangeControllerTest.php
index 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)));
@@ -61,6 +61,20 @@ class ExchangeControllerTest extends TestCase
$response->assertStatus(200);
}
+ /**
+ * @covers \FireflyIII\Http\Controllers\Json\ExchangeController
+ */
+ public function testGetRateAmount(): void
+ {
+ $repository = $this->mock(CurrencyRepositoryInterface::class);
+ $rate = factory(CurrencyExchangeRate::class)->make();
+ $repository->shouldReceive('getExchangeRate')->andReturn($rate);
+
+ $this->be($this->user());
+ $response = $this->get(route('json.rate', ['EUR', 'USD', '20170101']) . '?amount=10');
+ $response->assertStatus(200);
+ }
+
/**
* @covers \FireflyIII\Http\Controllers\Json\ExchangeController
*/
@@ -78,18 +92,4 @@ class ExchangeControllerTest extends TestCase
$response = $this->get(route('json.rate', ['EUR', 'USD', '20170101']));
$response->assertStatus(200);
}
-
- /**
- * @covers \FireflyIII\Http\Controllers\Json\ExchangeController
- */
- public function testGetRateAmount(): void
- {
- $repository = $this->mock(CurrencyRepositoryInterface::class);
- $rate = factory(CurrencyExchangeRate::class)->make();
- $repository->shouldReceive('getExchangeRate')->andReturn($rate);
-
- $this->be($this->user());
- $response = $this->get(route('json.rate', ['EUR', 'USD', '20170101']) . '?amount=10');
- $response->assertStatus(200);
- }
}
diff --git a/tests/Feature/Controllers/Json/FrontpageControllerTest.php b/tests/Feature/Controllers/Json/FrontpageControllerTest.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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('');
}
diff --git a/tests/Feature/Controllers/RuleGroupControllerTest.php b/tests/Feature/Controllers/RuleGroupControllerTest.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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 TestCase
public 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.php
index 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.php
index 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.php
index 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.php
index 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.php
index f7f1a9f082..1192df583a 100644
--- a/tests/TestCase.php
+++ b/tests/TestCase.php
@@ -119,6 +119,14 @@ abstract class TestCase extends BaseTestCase
return $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 BaseTestCase
return 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.php
index 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(),
@@ -243,196 +243,6 @@ class RecurrenceFactoryTest extends TestCase
$this->assertEquals($result->title, $data['recurrence']['title']);
}
- /**
- * Deposit. With piggy bank. With tags. With budget. With category.
- *
- * @covers \FireflyIII\Factory\RecurrenceFactory
- * @covers \FireflyIII\Services\Internal\Support\RecurringTransactionTrait
- */
- 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();
-
- // mock other factories:
- $piggyFactory = $this->mock(PiggyBankFactory::class);
- $budgetFactory = $this->mock(BudgetFactory::class);
- $categoryFactory = $this->mock(CategoryFactory::class);
- $accountRepos = $this->mock(AccountRepositoryInterface::class);
- $currencyFactory = $this->mock(TransactionCurrencyFactory::class);
-
- // mock calls:
- Amount::shouldReceive('getDefaultCurrencyByUser')->andReturn(TransactionCurrency::find(1))->once();
- $piggyFactory->shouldReceive('setUser')->once();
- $piggyFactory->shouldReceive('find')->withArgs([1, 'Bla bla'])->andReturn($piggyBank);
-
- $accountRepos->shouldReceive('setUser')->twice();
- $accountRepos->shouldReceive('findNull')->twice()->andReturn($accountA, $accountB);
-
- $currencyFactory->shouldReceive('find')->once()->withArgs([1, 'EUR'])->andReturn(null);
- $currencyFactory->shouldReceive('find')->once()->withArgs([null, null])->andReturn(null);
-
- $budgetFactory->shouldReceive('setUser')->once();
- $budgetFactory->shouldReceive('find')->withArgs([1, 'Some budget'])->once()->andReturn($budget);
-
- $categoryFactory->shouldReceive('setUser')->once();
- $categoryFactory->shouldReceive('findOrCreate')->withArgs([2, 'Some category'])->once()->andReturn($category);
-
- // data for basic recurrence.
- $data = [
- 'recurrence' => [
- 'type' => 'transfer',
- 'first_date' => Carbon::create()->addDay(),
- 'repetitions' => 0,
- 'title' => 'Test recurrence' . random_int(1, 100000),
- 'description' => 'Description thing',
- 'apply_rules' => true,
- 'active' => true,
- 'repeat_until' => null,
- ],
- 'meta' => [
- 'tags' => ['a', 'b', 'c'],
- 'piggy_bank_id' => 1,
- 'piggy_bank_name' => 'Bla bla',
- ],
- 'repetitions' => [
- [
- 'type' => 'daily',
- 'moment' => '',
- 'skip' => 0,
- 'weekend' => 1,
- ],
- ],
- 'transactions' => [
- [
- 'source_id' => 1,
- 'source_name' => 'Some name',
- 'destination_id' => 2,
- 'destination_name' => 'some otjer name',
- 'currency_id' => 1,
- 'currency_code' => 'EUR',
- 'foreign_currency_id' => null,
- 'foreign_currency_code' => null,
- 'foreign_amount' => null,
- 'description' => 'Bla bla bla',
- 'amount' => '100',
- 'budget_id' => 1,
- 'budget_name' => 'Some budget',
- 'category_id' => 2,
- 'category_name' => 'Some category',
-
- ],
- ],
- ];
-
- $typeFactory = $this->mock(TransactionTypeFactory::class);
- $typeFactory->shouldReceive('find')->once()->withArgs([ucfirst($data['recurrence']['type'])])->andReturn(TransactionType::find(3));
-
- $factory = new RecurrenceFactory;
- $factory->setUser($this->user());
-
- $result = $factory->create($data);
- $this->assertEquals($result->title, $data['recurrence']['title']);
- }
-
- /**
- * With piggy bank. With tags. With budget. With category.
- *
- * @covers \FireflyIII\Factory\RecurrenceFactory
- * @covers \FireflyIII\Services\Internal\Support\RecurringTransactionTrait
- */
- public function testBasicNoTags(): 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();
-
- // mock other factories:
- $piggyFactory = $this->mock(PiggyBankFactory::class);
- $budgetFactory = $this->mock(BudgetFactory::class);
- $categoryFactory = $this->mock(CategoryFactory::class);
- $accountRepos = $this->mock(AccountRepositoryInterface::class);
- $currencyFactory = $this->mock(TransactionCurrencyFactory::class);
-
- // mock calls:
- Amount::shouldReceive('getDefaultCurrencyByUser')->andReturn(TransactionCurrency::find(1))->once();
- $piggyFactory->shouldReceive('setUser')->once();
- $piggyFactory->shouldReceive('find')->withArgs([1, 'Bla bla'])->andReturn($piggyBank);
-
- $accountRepos->shouldReceive('setUser')->twice();
- $accountRepos->shouldReceive('findNull')->twice()->andReturn($accountA, $accountB);
-
- $currencyFactory->shouldReceive('find')->once()->withArgs([1, 'EUR'])->andReturn(null);
- $currencyFactory->shouldReceive('find')->once()->withArgs([null, null])->andReturn(null);
-
- $budgetFactory->shouldReceive('setUser')->once();
- $budgetFactory->shouldReceive('find')->withArgs([1, 'Some budget'])->once()->andReturn($budget);
-
- $categoryFactory->shouldReceive('setUser')->once();
- $categoryFactory->shouldReceive('findOrCreate')->withArgs([2, 'Some category'])->once()->andReturn($category);
-
- // data for basic recurrence.
- $data = [
- 'recurrence' => [
- 'type' => 'withdrawal',
- 'first_date' => Carbon::create()->addDay(),
- 'repetitions' => 0,
- 'title' => 'Test recurrence' . random_int(1, 100000),
- 'description' => 'Description thing',
- 'apply_rules' => true,
- 'active' => true,
- 'repeat_until' => null,
- ],
- 'meta' => [
- 'tags' => [],
- 'piggy_bank_id' => 1,
- 'piggy_bank_name' => 'Bla bla',
- ],
- 'repetitions' => [
- [
- 'type' => 'daily',
- 'moment' => '',
- 'skip' => 0,
- 'weekend' => 1,
- ],
- ],
- 'transactions' => [
- [
- 'source_id' => 1,
- 'source_name' => 'Some name',
- 'destination_id' => 2,
- 'destination_name' => 'some otjer name',
- 'currency_id' => 1,
- 'currency_code' => 'EUR',
- 'foreign_currency_id' => null,
- 'foreign_currency_code' => null,
- 'foreign_amount' => null,
- 'description' => 'Bla bla bla',
- 'amount' => '100',
- 'budget_id' => 1,
- 'budget_name' => 'Some budget',
- 'category_id' => 2,
- 'category_name' => 'Some category',
-
- ],
- ],
- ];
- $typeFactory = $this->mock(TransactionTypeFactory::class);
- $typeFactory->shouldReceive('find')->once()->withArgs([ucfirst($data['recurrence']['type'])])->andReturn(TransactionType::find(1));
- $factory = new RecurrenceFactory;
- $factory->setUser($this->user());
-
- $result = $factory->create($data);
- $this->assertEquals($result->title, $data['recurrence']['title']);
- }
-
/**
* No piggy bank. With tags. With budget. With category.
*
@@ -446,7 +256,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);
@@ -527,6 +337,196 @@ class RecurrenceFactoryTest extends TestCase
$this->assertEquals($result->title, $data['recurrence']['title']);
}
+ /**
+ * With piggy bank. With tags. With budget. With category.
+ *
+ * @covers \FireflyIII\Factory\RecurrenceFactory
+ * @covers \FireflyIII\Services\Internal\Support\RecurringTransactionTrait
+ */
+ public function testBasicNoTags(): 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();
+
+ // mock other factories:
+ $piggyFactory = $this->mock(PiggyBankFactory::class);
+ $budgetFactory = $this->mock(BudgetFactory::class);
+ $categoryFactory = $this->mock(CategoryFactory::class);
+ $accountRepos = $this->mock(AccountRepositoryInterface::class);
+ $currencyFactory = $this->mock(TransactionCurrencyFactory::class);
+
+ // mock calls:
+ Amount::shouldReceive('getDefaultCurrencyByUser')->andReturn(TransactionCurrency::find(1))->once();
+ $piggyFactory->shouldReceive('setUser')->once();
+ $piggyFactory->shouldReceive('find')->withArgs([1, 'Bla bla'])->andReturn($piggyBank);
+
+ $accountRepos->shouldReceive('setUser')->twice();
+ $accountRepos->shouldReceive('findNull')->twice()->andReturn($accountA, $accountB);
+
+ $currencyFactory->shouldReceive('find')->once()->withArgs([1, 'EUR'])->andReturn(null);
+ $currencyFactory->shouldReceive('find')->once()->withArgs([null, null])->andReturn(null);
+
+ $budgetFactory->shouldReceive('setUser')->once();
+ $budgetFactory->shouldReceive('find')->withArgs([1, 'Some budget'])->once()->andReturn($budget);
+
+ $categoryFactory->shouldReceive('setUser')->once();
+ $categoryFactory->shouldReceive('findOrCreate')->withArgs([2, 'Some category'])->once()->andReturn($category);
+
+ // data for basic recurrence.
+ $data = [
+ 'recurrence' => [
+ 'type' => 'withdrawal',
+ 'first_date' => Carbon::create()->addDay(),
+ 'repetitions' => 0,
+ 'title' => 'Test recurrence' . random_int(1, 100000),
+ 'description' => 'Description thing',
+ 'apply_rules' => true,
+ 'active' => true,
+ 'repeat_until' => null,
+ ],
+ 'meta' => [
+ 'tags' => [],
+ 'piggy_bank_id' => 1,
+ 'piggy_bank_name' => 'Bla bla',
+ ],
+ 'repetitions' => [
+ [
+ 'type' => 'daily',
+ 'moment' => '',
+ 'skip' => 0,
+ 'weekend' => 1,
+ ],
+ ],
+ 'transactions' => [
+ [
+ 'source_id' => 1,
+ 'source_name' => 'Some name',
+ 'destination_id' => 2,
+ 'destination_name' => 'some otjer name',
+ 'currency_id' => 1,
+ 'currency_code' => 'EUR',
+ 'foreign_currency_id' => null,
+ 'foreign_currency_code' => null,
+ 'foreign_amount' => null,
+ 'description' => 'Bla bla bla',
+ 'amount' => '100',
+ 'budget_id' => 1,
+ 'budget_name' => 'Some budget',
+ 'category_id' => 2,
+ 'category_name' => 'Some category',
+
+ ],
+ ],
+ ];
+ $typeFactory = $this->mock(TransactionTypeFactory::class);
+ $typeFactory->shouldReceive('find')->once()->withArgs([ucfirst($data['recurrence']['type'])])->andReturn(TransactionType::find(1));
+ $factory = new RecurrenceFactory;
+ $factory->setUser($this->user());
+
+ $result = $factory->create($data);
+ $this->assertEquals($result->title, $data['recurrence']['title']);
+ }
+
+ /**
+ * Deposit. With piggy bank. With tags. With budget. With category.
+ *
+ * @covers \FireflyIII\Factory\RecurrenceFactory
+ * @covers \FireflyIII\Services\Internal\Support\RecurringTransactionTrait
+ */
+ 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();
+
+ // mock other factories:
+ $piggyFactory = $this->mock(PiggyBankFactory::class);
+ $budgetFactory = $this->mock(BudgetFactory::class);
+ $categoryFactory = $this->mock(CategoryFactory::class);
+ $accountRepos = $this->mock(AccountRepositoryInterface::class);
+ $currencyFactory = $this->mock(TransactionCurrencyFactory::class);
+
+ // mock calls:
+ Amount::shouldReceive('getDefaultCurrencyByUser')->andReturn(TransactionCurrency::find(1))->once();
+ $piggyFactory->shouldReceive('setUser')->once();
+ $piggyFactory->shouldReceive('find')->withArgs([1, 'Bla bla'])->andReturn($piggyBank);
+
+ $accountRepos->shouldReceive('setUser')->twice();
+ $accountRepos->shouldReceive('findNull')->twice()->andReturn($accountA, $accountB);
+
+ $currencyFactory->shouldReceive('find')->once()->withArgs([1, 'EUR'])->andReturn(null);
+ $currencyFactory->shouldReceive('find')->once()->withArgs([null, null])->andReturn(null);
+
+ $budgetFactory->shouldReceive('setUser')->once();
+ $budgetFactory->shouldReceive('find')->withArgs([1, 'Some budget'])->once()->andReturn($budget);
+
+ $categoryFactory->shouldReceive('setUser')->once();
+ $categoryFactory->shouldReceive('findOrCreate')->withArgs([2, 'Some category'])->once()->andReturn($category);
+
+ // data for basic recurrence.
+ $data = [
+ 'recurrence' => [
+ 'type' => 'transfer',
+ 'first_date' => Carbon::create()->addDay(),
+ 'repetitions' => 0,
+ 'title' => 'Test recurrence' . random_int(1, 100000),
+ 'description' => 'Description thing',
+ 'apply_rules' => true,
+ 'active' => true,
+ 'repeat_until' => null,
+ ],
+ 'meta' => [
+ 'tags' => ['a', 'b', 'c'],
+ 'piggy_bank_id' => 1,
+ 'piggy_bank_name' => 'Bla bla',
+ ],
+ 'repetitions' => [
+ [
+ 'type' => 'daily',
+ 'moment' => '',
+ 'skip' => 0,
+ 'weekend' => 1,
+ ],
+ ],
+ 'transactions' => [
+ [
+ 'source_id' => 1,
+ 'source_name' => 'Some name',
+ 'destination_id' => 2,
+ 'destination_name' => 'some otjer name',
+ 'currency_id' => 1,
+ 'currency_code' => 'EUR',
+ 'foreign_currency_id' => null,
+ 'foreign_currency_code' => null,
+ 'foreign_amount' => null,
+ 'description' => 'Bla bla bla',
+ 'amount' => '100',
+ 'budget_id' => 1,
+ 'budget_name' => 'Some budget',
+ 'category_id' => 2,
+ 'category_name' => 'Some category',
+
+ ],
+ ],
+ ];
+
+ $typeFactory = $this->mock(TransactionTypeFactory::class);
+ $typeFactory->shouldReceive('find')->once()->withArgs([ucfirst($data['recurrence']['type'])])->andReturn(TransactionType::find(3));
+
+ $factory = new RecurrenceFactory;
+ $factory->setUser($this->user());
+
+ $result = $factory->create($data);
+ $this->assertEquals($result->title, $data['recurrence']['title']);
+ }
+
/**
* @covers \FireflyIII\Factory\RecurrenceFactory
*/
diff --git a/tests/Unit/Factory/TransactionFactoryTest.php b/tests/Unit/Factory/TransactionFactoryTest.php
index f4e8a88e32..ec09a76624 100644
--- a/tests/Unit/Factory/TransactionFactoryTest.php
+++ b/tests/Unit/Factory/TransactionFactoryTest.php
@@ -987,9 +987,9 @@ class TransactionFactoryTest extends TestCase
public 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.php
index 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.php
index 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.php
index 9184b02c94..febac12183 100644
--- a/tests/Unit/Generator/Chart/Basic/ChartJsGeneratorTest.php
+++ b/tests/Unit/Generator/Chart/Basic/ChartJsGeneratorTest.php
@@ -92,27 +92,6 @@ class ChartJsGeneratorTest extends TestCase
$this->assertEquals('#123456', $result['datasets'][1]['backgroundColor']);
}
- /**
- * @covers \FireflyIII\Generator\Chart\Basic\ChartJsGenerator
- */
- public function testPieChart(): void
- {
-
- $data = [
- 'one' => -1,
- 'two' => -2,
- 'three' => -3,
- ];
-
- /** @var ChartJsGenerator $generator */
- $generator = new ChartJsGenerator();
- $result = $generator->pieChart($data);
-
- $this->assertEquals('three', $result['labels'][0]);
- $this->assertEquals(3.0, $result['datasets'][0]['data'][0]);
-
- }
-
/**
* @covers \FireflyIII\Generator\Chart\Basic\ChartJsGenerator
*/
@@ -120,9 +99,9 @@ class ChartJsGeneratorTest extends TestCase
{
$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 */
@@ -141,9 +120,9 @@ class ChartJsGeneratorTest extends TestCase
{
$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 */
@@ -155,6 +134,27 @@ class ChartJsGeneratorTest extends TestCase
}
+ /**
+ * @covers \FireflyIII\Generator\Chart\Basic\ChartJsGenerator
+ */
+ public function testPieChart(): void
+ {
+
+ $data = [
+ 'one' => -1,
+ 'two' => -2,
+ 'three' => -3,
+ ];
+
+ /** @var ChartJsGenerator $generator */
+ $generator = new ChartJsGenerator();
+ $result = $generator->pieChart($data);
+
+ $this->assertEquals('three', $result['labels'][0]);
+ $this->assertEquals(3.0, $result['datasets'][0]['data'][0]);
+
+ }
+
/**
* @covers \FireflyIII\Generator\Chart\Basic\ChartJsGenerator
*/
diff --git a/tests/Unit/Handlers/Events/AdminEventHandlerTest.php b/tests/Unit/Handlers/Events/AdminEventHandlerTest.php
index 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.php
index 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.php
index 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 MetaPieChartTest
diff --git a/tests/Unit/Helpers/Help/HelpTest.php b/tests/Unit/Helpers/Help/HelpTest.php
index 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('Some help text.
'."\n", $result);
+ $this->assertEquals('Some help text.
' . "\n", $result);
}
/**
diff --git a/tests/Unit/Middleware/AuthenticateTest.php b/tests/Unit/Middleware/AuthenticateTest.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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 TestCase
putenv('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.php
index 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.php
index 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.php
index 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.php
index 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.php
index 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();