Skip to content

Firefly III: a personal finances manager

Optimise test code.

James Cole5d1cfc661f19
diff --git a/app/Api/V1/Controllers/AccountController.php b/app/Api/V1/Controllers/AccountController.php
index 73c1ac2839..97090d71ba 100644
--- a/app/Api/V1/Controllers/AccountController.php
+++ b/app/Api/V1/Controllers/AccountController.php
@@ -233,6 +233,9 @@ class AccountController extends Controller
* @param Account $account
*
* @return JsonResponse
+ *
+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
+ * @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function transactions(Request $request, Account $account): JsonResponse
{
@@ -249,8 +252,6 @@ class AccountController extends Controller
$types = $this->mapTransactionTypes($this->parameters->get('type'));
$manager = new Manager();
$baseUrl = $request->getSchemeAndHttpHost() . '/api/v1';
-
-
$manager->setSerializer(new JsonApiSerializer($baseUrl));
/** @var User $admin */
@@ -259,18 +260,8 @@ class AccountController extends Controller
// use new group collector:
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
- $collector
- ->setUser($admin)
- // set the account to filter on to the current one:
- ->setAccounts(new Collection([$account]))
- // all info needed for the API:
- ->withAPIInformation()
- // set page size:
- ->setLimit($pageSize)
- // set page to retrieve
- ->setPage($this->parameters->get('page'))
- // set types of transactions to return.
- ->setTypes($types);
+ $collector->setUser($admin)->setAccounts(new Collection([$account]))
+ ->withAPIInformation()->setLimit($pageSize)->setPage($this->parameters->get('page'))->setTypes($types);
// set range if necessary:
if (null !== $this->parameters->get('start') && null !== $this->parameters->get('end')) {
diff --git a/app/Api/V1/Controllers/BillController.php b/app/Api/V1/Controllers/BillController.php
index c5806ad04b..7378704588 100644
--- a/app/Api/V1/Controllers/BillController.php
+++ b/app/Api/V1/Controllers/BillController.php
@@ -47,6 +47,8 @@ use League\Fractal\Serializer\JsonApiSerializer;
/**
* Class BillController.
+ *
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class BillController extends Controller
{
diff --git a/app/Api/V1/Controllers/Chart/CategoryController.php b/app/Api/V1/Controllers/Chart/CategoryController.php
index fd1d4d08a1..1314983f16 100644
--- a/app/Api/V1/Controllers/Chart/CategoryController.php
+++ b/app/Api/V1/Controllers/Chart/CategoryController.php
@@ -64,6 +64,8 @@ class CategoryController extends Controller
* @param DateRequest $request
*
* @return JsonResponse
+ *
+ * TODO after 4.8.0, simplify
*/
public function overview(DateRequest $request): JsonResponse
{
diff --git a/app/Api/V1/Requests/RuleGroupTriggerRequest.php b/app/Api/V1/Requests/RuleGroupTriggerRequest.php
index c57f2fed51..a9912ae845 100644
--- a/app/Api/V1/Requests/RuleGroupTriggerRequest.php
+++ b/app/Api/V1/Requests/RuleGroupTriggerRequest.php
@@ -98,6 +98,7 @@ class RuleGroupTriggerRequest extends Request
Log::debug(sprintf('Searching for asset account with id "%s"', $accountId));
$account = $accountRepository->findNull((int)$accountId);
if ($this->validAccount($account)) {
+ /** @noinspection NullPointerExceptionInspection */
Log::debug(sprintf('Found account #%d ("%s") and its an asset account', $account->id, $account->name));
$accounts->push($account);
}
diff --git a/app/Console/Commands/Upgrade/MigrateToRules.php b/app/Console/Commands/Upgrade/MigrateToRules.php
index cd7ee995a1..880dcaab3e 100644
--- a/app/Console/Commands/Upgrade/MigrateToRules.php
+++ b/app/Console/Commands/Upgrade/MigrateToRules.php
@@ -204,8 +204,10 @@ class MigrateToRules extends Command
],
],
'actions' => [
- 'type' => 'link_to_bill',
- 'value' => $bill->name,
+ [
+ 'type' => 'link_to_bill',
+ 'value' => $bill->name,
+ ],
],
];
diff --git a/app/Exceptions/FireflyException.php b/app/Exceptions/FireflyException.php
index 16c24f25aa..79afaf860a 100644
--- a/app/Exceptions/FireflyException.php
+++ b/app/Exceptions/FireflyException.php
@@ -28,6 +28,7 @@ use Exception;
/**
* Class FireflyException.
+ * @codeCoverageIgnore
*/
class FireflyException extends Exception
{
diff --git a/app/Exceptions/NotImplementedException.php b/app/Exceptions/NotImplementedException.php
index 83aa21fbee..060cd32b67 100644
--- a/app/Exceptions/NotImplementedException.php
+++ b/app/Exceptions/NotImplementedException.php
@@ -28,6 +28,7 @@ use Exception;
/**
* Class NotImplementedException.
+ * @codeCoverageIgnore
*/
class NotImplementedException extends Exception
{
diff --git a/app/Exceptions/ValidationException.php b/app/Exceptions/ValidationException.php
index db8c115fd1..65c4037fd6 100644
--- a/app/Exceptions/ValidationException.php
+++ b/app/Exceptions/ValidationException.php
@@ -28,6 +28,7 @@ use Exception;
/**
* Class ValidationExceptions.
+ * @codeCoverageIgnore
*/
class ValidationException extends Exception
{
diff --git a/tests/Api/V1/Controllers/Chart/AccountControllerTest.php b/tests/Api/V1/Controllers/Chart/AccountControllerTest.php
index 75e75d04a1..088f14dce1 100644
--- a/tests/Api/V1/Controllers/Chart/AccountControllerTest.php
+++ b/tests/Api/V1/Controllers/Chart/AccountControllerTest.php
@@ -96,8 +96,8 @@ class AccountControllerTest extends TestCase
// mock repositories
$repository = $this->mock(AccountRepositoryInterface::class);
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
- $revenue = $this->getRandomRevenue();
- $euro = $this->getEuro();
+ $revenue = $this->getRandomRevenue();
+ $euro = $this->getEuro();
// mock calls:
$repository->shouldReceive('setUser')->atLeast()->once();
$currencyRepos->shouldReceive('setUser')->atLeast()->once();
diff --git a/tests/Api/V1/Controllers/Chart/AvailableBudgetControllerTest.php b/tests/Api/V1/Controllers/Chart/AvailableBudgetControllerTest.php
index 10d4c1e594..021e61f38a 100644
--- a/tests/Api/V1/Controllers/Chart/AvailableBudgetControllerTest.php
+++ b/tests/Api/V1/Controllers/Chart/AvailableBudgetControllerTest.php
@@ -34,8 +34,8 @@ use Tests\TestCase;
class AvailableBudgetControllerTest extends TestCase
{
/**
- *
- */
+ *
+ */
public function setUp(): void
{
parent::setUp();
diff --git a/tests/Api/V1/Controllers/CurrencyControllerTest.php b/tests/Api/V1/Controllers/CurrencyControllerTest.php
index e3b535ca26..58ab66abf4 100644
--- a/tests/Api/V1/Controllers/CurrencyControllerTest.php
+++ b/tests/Api/V1/Controllers/CurrencyControllerTest.php
@@ -62,9 +62,9 @@ class CurrencyControllerTest extends TestCase
public function testStore(): void
{
- $currency = TransactionCurrency::first();
- $repository = $this->mock(CurrencyRepositoryInterface::class);
- $transformer = $this->mock(CurrencyTransformer::class);
+ $currency = TransactionCurrency::first();
+ $repository = $this->mock(CurrencyRepositoryInterface::class);
+ $transformer = $this->mock(CurrencyTransformer::class);
$userRepository = $this->mock(UserRepositoryInterface::class);
// mock transformer
@@ -102,9 +102,9 @@ class CurrencyControllerTest extends TestCase
*/
public function testStoreWithDefault(): void
{
- $currency = TransactionCurrency::first();
- $repository = $this->mock(CurrencyRepositoryInterface::class);
- $transformer = $this->mock(CurrencyTransformer::class);
+ $currency = TransactionCurrency::first();
+ $repository = $this->mock(CurrencyRepositoryInterface::class);
+ $transformer = $this->mock(CurrencyTransformer::class);
$userRepository = $this->mock(UserRepositoryInterface::class);
// mock transformer
@@ -188,9 +188,9 @@ class CurrencyControllerTest extends TestCase
*/
public function testUpdateWithDefault(): void
{
- $currency = TransactionCurrency::first();
- $repository = $this->mock(CurrencyRepositoryInterface::class);
- $transformer = $this->mock(CurrencyTransformer::class);
+ $currency = TransactionCurrency::first();
+ $repository = $this->mock(CurrencyRepositoryInterface::class);
+ $transformer = $this->mock(CurrencyTransformer::class);
$this->mock(UserRepositoryInterface::class);
$preference = new Preference;
$preference->data = 'EUR';
diff --git a/tests/Api/V1/Controllers/LinkTypeControllerTest.php b/tests/Api/V1/Controllers/LinkTypeControllerTest.php
index 23e4ebb49a..f3cbec6e10 100644
--- a/tests/Api/V1/Controllers/LinkTypeControllerTest.php
+++ b/tests/Api/V1/Controllers/LinkTypeControllerTest.php
@@ -180,7 +180,7 @@ class LinkTypeControllerTest extends TestCase
public function testUpdateNotEditable(): void
{
// mock stuff:
- $repository = $this->mock(LinkTypeRepositoryInterface::class);
+ $repository = $this->mock(LinkTypeRepositoryInterface::class);
$userRepository = $this->mock(UserRepositoryInterface::class);
// create editable link type:
diff --git a/tests/Api/V1/Controllers/PreferencesControllerTest.php b/tests/Api/V1/Controllers/PreferencesControllerTest.php
index 386f1d9cad..07a709be5c 100644
--- a/tests/Api/V1/Controllers/PreferencesControllerTest.php
+++ b/tests/Api/V1/Controllers/PreferencesControllerTest.php
@@ -56,7 +56,7 @@ class PreferencesControllerTest extends TestCase
*/
public function testUpdateArray(): void
{
- $transformer = $this->mock(PreferenceTransformer::class);
+ $transformer = $this->mock(PreferenceTransformer::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
// mock calls to transformer:
@@ -80,7 +80,7 @@ class PreferencesControllerTest extends TestCase
*/
public function testUpdateBoolean(): void
{
- $transformer = $this->mock(PreferenceTransformer::class);
+ $transformer = $this->mock(PreferenceTransformer::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
// mock calls to transformer:
@@ -105,7 +105,7 @@ class PreferencesControllerTest extends TestCase
*/
public function testUpdateDefault(): void
{
- $transformer = $this->mock(PreferenceTransformer::class);
+ $transformer = $this->mock(PreferenceTransformer::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
// mock calls to transformer:
@@ -129,7 +129,7 @@ class PreferencesControllerTest extends TestCase
*/
public function testUpdateInteger(): void
{
- $transformer = $this->mock(PreferenceTransformer::class);
+ $transformer = $this->mock(PreferenceTransformer::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
// mock calls to transformer:
diff --git a/tests/Unit/Console/Commands/Correction/DeleteEmptyJournalsTest.php b/tests/Unit/Console/Commands/Correction/DeleteEmptyJournalsTest.php
index 85385a268e..47bad505d8 100644
--- a/tests/Unit/Console/Commands/Correction/DeleteEmptyJournalsTest.php
+++ b/tests/Unit/Console/Commands/Correction/DeleteEmptyJournalsTest.php
@@ -104,7 +104,7 @@ class DeleteEmptyJournalsTest extends TestCase
$this->artisan('firefly-iii:delete-empty-journals')
->expectsOutput(sprintf('Deleted transaction journal #%d because it had an uneven number of transactions.', $journal->id))
- ->expectsOutput('No empty transaction journals.')
+ ->expectsOutput('No empty transaction journals.')
->assertExitCode(0);
// verify both are gone
diff --git a/tests/Unit/Console/Commands/Correction/EnableCurrenciesTest.php b/tests/Unit/Console/Commands/Correction/EnableCurrenciesTest.php
index 6c29cb5b73..40163938c8 100644
--- a/tests/Unit/Console/Commands/Correction/EnableCurrenciesTest.php
+++ b/tests/Unit/Console/Commands/Correction/EnableCurrenciesTest.php
@@ -50,7 +50,7 @@ class EnableCurrenciesTest extends TestCase
$count = TransactionCurrency::where('enabled', 1)->count();
$this->artisan('firefly-iii:enable-currencies')
- ->expectsOutput('All currencies are correctly enabled or disabled.')
+ ->expectsOutput('All currencies are correctly enabled or disabled.')
->assertExitCode(0);
diff --git a/tests/Unit/Console/Commands/Correction/RenameMetaFieldsTest.php b/tests/Unit/Console/Commands/Correction/RenameMetaFieldsTest.php
index 95a4db4118..34e8d6a1bf 100644
--- a/tests/Unit/Console/Commands/Correction/RenameMetaFieldsTest.php
+++ b/tests/Unit/Console/Commands/Correction/RenameMetaFieldsTest.php
@@ -46,7 +46,7 @@ class RenameMetaFieldsTest extends TestCase
public function testHandle(): void
{
$this->artisan('firefly-iii:rename-meta-fields')
- ->expectsOutput('All meta fields are correct.')
+ ->expectsOutput('All meta fields are correct.')
->assertExitCode(0);
}
@@ -66,7 +66,7 @@ class RenameMetaFieldsTest extends TestCase
);
$this->artisan('firefly-iii:rename-meta-fields')
- ->expectsOutput('Renamed 1 meta field(s).')
+ ->expectsOutput('Renamed 1 meta field(s).')
->assertExitCode(0);
// verify update
diff --git a/tests/Unit/Console/Commands/DecryptDatabaseTest.php b/tests/Unit/Console/Commands/DecryptDatabaseTest.php
index 35c65bff5a..dde70b3b15 100644
--- a/tests/Unit/Console/Commands/DecryptDatabaseTest.php
+++ b/tests/Unit/Console/Commands/DecryptDatabaseTest.php
@@ -61,7 +61,6 @@ class DecryptDatabaseTest extends TestCase
]);
-
FireflyConfig::shouldReceive('get')->withArgs([Mockery::any(), false])->atLeast()->once()->andReturn(null);
FireflyConfig::shouldReceive('set')->withArgs([Mockery::any(), true])->atLeast()->once();
@@ -113,9 +112,9 @@ class DecryptDatabaseTest extends TestCase
public function testHandleNotEncrypted(): void
{
// create encrypted account:
- $name = 'Encrypted name';
- $iban = 'HR1723600001101234565';
- $account = Account::create(
+ $name = 'Encrypted name';
+ $iban = 'HR1723600001101234565';
+ $account = Account::create(
[
'user_id' => 1,
'account_type_id' => 1,
diff --git a/tests/Unit/Console/Commands/Tools/ApplyRulesTest.php b/tests/Unit/Console/Commands/Tools/ApplyRulesTest.php
index e43e604854..24e77f96c3 100644
--- a/tests/Unit/Console/Commands/Tools/ApplyRulesTest.php
+++ b/tests/Unit/Console/Commands/Tools/ApplyRulesTest.php
@@ -27,6 +27,7 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\Repositories\Rule\RuleRepositoryInterface;
use FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface;
+use FireflyIII\Repositories\User\UserRepositoryInterface;
use FireflyIII\TransactionRules\Engine\RuleEngine;
use Illuminate\Support\Collection;
use Log;
@@ -59,6 +60,7 @@ class ApplyRulesTest extends TestCase
$collector = $this->mock(GroupCollectorInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$ruleEngine = $this->mock(RuleEngine::class);
+ $userRepos = $this->mock(UserRepositoryInterface::class);
// data
$asset = $this->getRandomAsset();
@@ -69,6 +71,7 @@ class ApplyRulesTest extends TestCase
$rules = new Collection([$rule]);
// expected calls:
+ $userRepos->shouldReceive('findNull')->atLeast()->once()->andReturn($this->user());
$ruleRepos->shouldReceive('setUser')->atLeast()->once();
$ruleGroupRepos->shouldReceive('setUser')->atLeast()->once();
$accountRepos->shouldReceive('setUser')->atLeast()->once();
@@ -109,7 +112,7 @@ class ApplyRulesTest extends TestCase
*
* @covers \FireflyIII\Console\Commands\Tools\ApplyRules
*/
- public function testHandEmptye(): void
+ public function testHandEmpty(): void
{
$ruleRepos = $this->mock(RuleRepositoryInterface::class);
$ruleGroupRepos = $this->mock(RuleGroupRepositoryInterface::class);
@@ -117,6 +120,7 @@ class ApplyRulesTest extends TestCase
$collector = $this->mock(GroupCollectorInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$ruleEngine = $this->mock(RuleEngine::class);
+ $userRepos = $this->mock(UserRepositoryInterface::class);
// data
$asset = $this->getRandomAsset();
@@ -125,6 +129,7 @@ class ApplyRulesTest extends TestCase
$groups = new Collection([$group]);
// expected calls:
+ $userRepos->shouldReceive('findNull')->atLeast()->once()->andReturn($this->user());
$ruleRepos->shouldReceive('setUser')->atLeast()->once();
$ruleGroupRepos->shouldReceive('setUser')->atLeast()->once();
$accountRepos->shouldReceive('setUser')->atLeast()->once();
@@ -172,6 +177,7 @@ class ApplyRulesTest extends TestCase
$collector = $this->mock(GroupCollectorInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$ruleEngine = $this->mock(RuleEngine::class);
+ $userRepos = $this->mock(UserRepositoryInterface::class);
// data
$asset = $this->getRandomAsset();
@@ -181,6 +187,7 @@ class ApplyRulesTest extends TestCase
$rules = new Collection([$rule]);
// expected calls:
+ $userRepos->shouldReceive('findNull')->atLeast()->once()->andReturn($this->user());
$ruleRepos->shouldReceive('setUser')->atLeast()->once();
$ruleGroupRepos->shouldReceive('setUser')->atLeast()->once();
$accountRepos->shouldReceive('setUser')->atLeast()->once();
@@ -227,6 +234,7 @@ class ApplyRulesTest extends TestCase
$collector = $this->mock(GroupCollectorInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$ruleEngine = $this->mock(RuleEngine::class);
+ $userRepos = $this->mock(UserRepositoryInterface::class);
// data
$asset = $this->getRandomAsset();
@@ -238,6 +246,7 @@ class ApplyRulesTest extends TestCase
$rules = new Collection([$activeRule]);
// expected calls:
+ $userRepos->shouldReceive('findNull')->atLeast()->once()->andReturn($this->user());
$ruleRepos->shouldReceive('setUser')->atLeast()->once();
$ruleGroupRepos->shouldReceive('setUser')->atLeast()->once();
$accountRepos->shouldReceive('setUser')->atLeast()->once();
@@ -287,6 +296,7 @@ class ApplyRulesTest extends TestCase
$collector = $this->mock(GroupCollectorInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$ruleEngine = $this->mock(RuleEngine::class);
+ $userRepos = $this->mock(UserRepositoryInterface::class);
$activeGroup = $this->user()->ruleGroups()->where('active', 1)->inRandomOrder()->first();
$inactiveGroup = $this->user()->ruleGroups()->where('active', 0)->inRandomOrder()->first();
@@ -299,6 +309,7 @@ class ApplyRulesTest extends TestCase
$rules = new Collection([$rule]);
// expected calls:
+ $userRepos->shouldReceive('findNull')->atLeast()->once()->andReturn($this->user());
$ruleRepos->shouldReceive('setUser')->atLeast()->once();
$ruleGroupRepos->shouldReceive('setUser')->atLeast()->once();
$accountRepos->shouldReceive('setUser')->atLeast()->once();
@@ -348,8 +359,10 @@ class ApplyRulesTest extends TestCase
$this->mock(GroupCollectorInterface::class);
$this->mock(AccountRepositoryInterface::class);
$this->mock(RuleEngine::class);
+ $userRepos = $this->mock(UserRepositoryInterface::class);
// expected calls:
+ $userRepos->shouldReceive('findNull')->atLeast()->once()->andReturn($this->user());
$ruleRepos->shouldReceive('setUser')->atLeast()->once();
$ruleGroupRepos->shouldReceive('setUser')->atLeast()->once();
@@ -374,15 +387,17 @@ class ApplyRulesTest extends TestCase
{
$ruleRepos = $this->mock(RuleRepositoryInterface::class);
$ruleGroupRepos = $this->mock(RuleGroupRepositoryInterface::class);
+ $accountRepos = $this->mock(AccountRepositoryInterface::class);
+ $userRepos = $this->mock(UserRepositoryInterface::class);
+ $this->mock(RuleEngine::class);
$this->mock(JournalRepositoryInterface::class);
$this->mock(GroupCollectorInterface::class);
- $accountRepos = $this->mock(AccountRepositoryInterface::class);
- $this->mock(RuleEngine::class);
// data
$expense = $this->getRandomExpense();
// expected calls:
+ $userRepos->shouldReceive('findNull')->atLeast()->once()->andReturn($this->user());
$ruleRepos->shouldReceive('setUser')->atLeast()->once();
$ruleGroupRepos->shouldReceive('setUser')->atLeast()->once();
$accountRepos->shouldReceive('setUser')->atLeast()->once();
diff --git a/tests/Unit/Console/Commands/Upgrade/BudgetLimitCurrencyTest.php b/tests/Unit/Console/Commands/Upgrade/BudgetLimitCurrencyTest.php
index 34c6cddc50..4f3d4ed410 100644
--- a/tests/Unit/Console/Commands/Upgrade/BudgetLimitCurrencyTest.php
+++ b/tests/Unit/Console/Commands/Upgrade/BudgetLimitCurrencyTest.php
@@ -50,7 +50,7 @@ class BudgetLimitCurrencyTest extends TestCase
BudgetLimit::whereNull('transaction_currency_id')->forceDelete();
$this->artisan('firefly-iii:bl-currency')
- ->expectsOutput('All budget limits are correct.')
+ ->expectsOutput('All budget limits are correct.')
->assertExitCode(0);
}
diff --git a/tests/Unit/Console/Commands/Upgrade/MigrateToGroupsTest.php b/tests/Unit/Console/Commands/Upgrade/MigrateToGroupsTest.php
index 2b5c4d24ae..d0cfbd70e5 100644
--- a/tests/Unit/Console/Commands/Upgrade/MigrateToGroupsTest.php
+++ b/tests/Unit/Console/Commands/Upgrade/MigrateToGroupsTest.php
@@ -57,6 +57,8 @@ class MigrateToGroupsTest extends TestCase
public function testHandle(): void
{
$journalRepos = $this->mock(JournalRepositoryInterface::class);
+ $service = $this->mock(JournalDestroyService::class);
+ $groupFactory = $this->mock(TransactionGroupFactory::class);
// mock calls:
$journalRepos->shouldReceive('getSplitJournals')
@@ -85,9 +87,12 @@ class MigrateToGroupsTest extends TestCase
public function testHandleNoGroup(): void
{
$journalRepos = $this->mock(JournalRepositoryInterface::class);
- $asset = $this->getRandomAsset();
- $expense = $this->getRandomExpense();
- $journal = TransactionJournal::create(
+ $service = $this->mock(JournalDestroyService::class);
+ $groupFactory = $this->mock(TransactionGroupFactory::class);
+
+ $asset = $this->getRandomAsset();
+ $expense = $this->getRandomExpense();
+ $journal = TransactionJournal::create(
[
'user_id' => 1,
'transaction_currency_id' => 1,
@@ -97,7 +102,7 @@ class MigrateToGroupsTest extends TestCase
'date' => '2019-01-01',
]
);
- $one = Transaction::create(
+ $one = Transaction::create(
[
'transaction_journal_id' => $journal->id,
'account_id' => $asset->id,
@@ -105,7 +110,7 @@ class MigrateToGroupsTest extends TestCase
'identifier' => 1,
]
);
- $two = Transaction::create(
+ $two = Transaction::create(
[
'transaction_journal_id' => $journal->id,
'account_id' => $expense->id,
@@ -113,7 +118,7 @@ class MigrateToGroupsTest extends TestCase
'identifier' => 1,
]
);
- $array = $journal->toArray();
+ $array = $journal->toArray();
// mock calls:
$journalRepos->shouldReceive('getSplitJournals')
diff --git a/tests/Unit/Console/Commands/Upgrade/TransactionIdentifierTest.php b/tests/Unit/Console/Commands/Upgrade/TransactionIdentifierTest.php
index b1c8ef1daf..042f506a6d 100644
--- a/tests/Unit/Console/Commands/Upgrade/TransactionIdentifierTest.php
+++ b/tests/Unit/Console/Commands/Upgrade/TransactionIdentifierTest.php
@@ -140,7 +140,7 @@ class TransactionIdentifierTest extends TestCase
// assume all is well.
$this->artisan('firefly-iii:transaction-identifiers')
- ->expectsOutput('Fixed 2 split journal transaction identifier(s).')
+ ->expectsOutput('Fixed 2 split journal transaction identifier(s).')
->assertExitCode(0);
// see results:
diff --git a/tests/Unit/Factory/PiggyBankEventFactoryTest.php b/tests/Unit/Factory/PiggyBankEventFactoryTest.php
index 9ff76e13e0..347b9a1464 100644
--- a/tests/Unit/Factory/PiggyBankEventFactoryTest.php
+++ b/tests/Unit/Factory/PiggyBankEventFactoryTest.php
@@ -75,7 +75,8 @@ class PiggyBankEventFactoryTest extends TestCase
* @covers \FireflyIII\Factory\PiggyBankEventFactory
*/
public function testCreateNoPiggy(): void
- { $this->markTestIncomplete('Needs to be rewritten for v4.8.0');
+ {
+ $this->markTestIncomplete('Needs to be rewritten for v4.8.0');
return;
/** @var TransactionJournal $transfer */
@@ -93,7 +94,8 @@ class PiggyBankEventFactoryTest extends TestCase
* @covers \FireflyIII\Factory\PiggyBankEventFactory
*/
public function testCreateNoRep(): void
- { $this->markTestIncomplete('Needs to be rewritten for v4.8.0');
+ {
+ $this->markTestIncomplete('Needs to be rewritten for v4.8.0');
return;
/** @var TransactionJournal $transfer */
@@ -115,7 +117,8 @@ class PiggyBankEventFactoryTest extends TestCase
* @covers \FireflyIII\Factory\PiggyBankEventFactory
*/
public function testCreateNotTransfer(): void
- { $this->markTestIncomplete('Needs to be rewritten for v4.8.0');
+ {
+ $this->markTestIncomplete('Needs to be rewritten for v4.8.0');
return;
/** @var TransactionJournal $deposit */
@@ -131,7 +134,8 @@ class PiggyBankEventFactoryTest extends TestCase
* @covers \FireflyIII\Factory\PiggyBankEventFactory
*/
public function testCreateSuccess(): void
- { $this->markTestIncomplete('Needs to be rewritten for v4.8.0');
+ {
+ $this->markTestIncomplete('Needs to be rewritten for v4.8.0');
return;
/** @var TransactionJournal $transfer */
diff --git a/tests/Unit/Factory/TransactionJournalMetaFactoryTest.php b/tests/Unit/Factory/TransactionJournalMetaFactoryTest.php
index 705c35fd54..f0dcf19fd3 100644
--- a/tests/Unit/Factory/TransactionJournalMetaFactoryTest.php
+++ b/tests/Unit/Factory/TransactionJournalMetaFactoryTest.php
@@ -49,7 +49,8 @@ class TransactionJournalMetaFactoryTest extends TestCase
* @covers \FireflyIII\Factory\TransactionJournalMetaFactory
*/
public function testUpdateOrCreateBasic(): void
- { $this->markTestIncomplete('Needs to be rewritten for v4.8.0');
+ {
+ $this->markTestIncomplete('Needs to be rewritten for v4.8.0');
return;
/** @var TransactionJournal $journal */
@@ -72,7 +73,8 @@ class TransactionJournalMetaFactoryTest extends TestCase
* @covers \FireflyIII\Factory\TransactionJournalMetaFactory
*/
public function testUpdateOrCreateDate(): void
- { $this->markTestIncomplete('Needs to be rewritten for v4.8.0');
+ {
+ $this->markTestIncomplete('Needs to be rewritten for v4.8.0');
return;
/** @var TransactionJournal $journal */
@@ -95,7 +97,8 @@ class TransactionJournalMetaFactoryTest extends TestCase
* @covers \FireflyIII\Factory\TransactionJournalMetaFactory
*/
public function testUpdateOrCreateDeleteExisting(): void
- { $this->markTestIncomplete('Needs to be rewritten for v4.8.0');
+ {
+ $this->markTestIncomplete('Needs to be rewritten for v4.8.0');
return;
/** @var TransactionJournal $journal */
@@ -125,7 +128,8 @@ class TransactionJournalMetaFactoryTest extends TestCase
* @covers \FireflyIII\Factory\TransactionJournalMetaFactory
*/
public function testUpdateOrCreateEmpty(): void
- { $this->markTestIncomplete('Needs to be rewritten for v4.8.0');
+ {
+ $this->markTestIncomplete('Needs to be rewritten for v4.8.0');
return;
/** @var TransactionJournal $journal */
@@ -148,7 +152,8 @@ class TransactionJournalMetaFactoryTest extends TestCase
* @covers \FireflyIII\Factory\TransactionJournalMetaFactory
*/
public function testUpdateOrCreateExistingEmpty(): void
- { $this->markTestIncomplete('Needs to be rewritten for v4.8.0');
+ {
+ $this->markTestIncomplete('Needs to be rewritten for v4.8.0');
return;
/** @var TransactionJournal $journal */
diff --git a/tests/Unit/Import/Storage/ImportArrayStorageTest.php b/tests/Unit/Import/Storage/ImportArrayStorageTest.php
index 581ab99046..c47fdcbefc 100644
--- a/tests/Unit/Import/Storage/ImportArrayStorageTest.php
+++ b/tests/Unit/Import/Storage/ImportArrayStorageTest.php
@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace Tests\Unit\Import\Storage;
use Carbon\Carbon;
+use Exception;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Helpers\Collector\TransactionCollector;
use FireflyIII\Helpers\Collector\TransactionCollectorInterface;
@@ -620,7 +621,7 @@ class ImportArrayStorageTest extends TestCase
/**
* @return array
- * @throws \Exception
+ * @throws Exception
*/
private function singleTransfer(): array
{
@@ -669,7 +670,7 @@ class ImportArrayStorageTest extends TestCase
/**
* @return array
- * @throws \Exception
+ * @throws Exception
*/
private function singleWithdrawal(): array
{
diff --git a/tests/Unit/Middleware/BinderTest.php b/tests/Unit/Middleware/BinderTest.php
index 88d6b03917..9fd7937093 100644
--- a/tests/Unit/Middleware/BinderTest.php
+++ b/tests/Unit/Middleware/BinderTest.php
@@ -835,7 +835,8 @@ class BinderTest extends TestCase
* @covers \FireflyIII\Support\Binder\JournalList
*/
public function testJournalList(): void
- { $this->markTestIncomplete('Needs to be rewritten for v4.8.0');
+ {
+ $this->markTestIncomplete('Needs to be rewritten for v4.8.0');
return;
Route::middleware(Binder::class)->any(
@@ -854,7 +855,8 @@ class BinderTest extends TestCase
* @covers \FireflyIII\Support\Binder\JournalList
*/
public function testJournalListEmpty(): void
- { $this->markTestIncomplete('Needs to be rewritten for v4.8.0');
+ {
+ $this->markTestIncomplete('Needs to be rewritten for v4.8.0');
return;
Route::middleware(Binder::class)->any(
diff --git a/tests/Unit/Support/Import/Placeholder/ImportTransactionTest.php b/tests/Unit/Support/Import/Placeholder/ImportTransactionTest.php
index ac2929d94e..c821a5ce2b 100644
--- a/tests/Unit/Support/Import/Placeholder/ImportTransactionTest.php
+++ b/tests/Unit/Support/Import/Placeholder/ImportTransactionTest.php
@@ -498,8 +498,8 @@ class ImportTransactionTest extends TestCase
*/
public function testCalculateAmountNeg(): void
{
- $importTransaction = new ImportTransaction;
- $importTransaction->amount = '2.99';
+ $importTransaction = new ImportTransaction;
+ $importTransaction->amount = '2.99';
$importTransaction->modifiers['generic-debit-credit'] = 'D';
try {
$this->assertEquals('-2.99', $importTransaction->calculateAmount());
@@ -635,8 +635,8 @@ class ImportTransactionTest extends TestCase
*/
public function testForeignAmountModNeg(): void
{
- $importTransaction = new ImportTransaction;
- $importTransaction->foreignAmount = '6.77';
+ $importTransaction = new ImportTransaction;
+ $importTransaction->foreignAmount = '6.77';
$importTransaction->modifiers['generic-debit-credit'] = 'D';
$this->assertEquals('-6.77', $importTransaction->calculateForeignAmount());
}
@@ -648,8 +648,8 @@ class ImportTransactionTest extends TestCase
*/
public function testForeignAmountModPos(): void
{
- $importTransaction = new ImportTransaction;
- $importTransaction->foreignAmount = '-5.77';
+ $importTransaction = new ImportTransaction;
+ $importTransaction->foreignAmount = '-5.77';
$importTransaction->modifiers['generic-debit-credit'] = 'C';
$this->assertEquals('5.77', $importTransaction->calculateForeignAmount());
}
diff --git a/tests/Unit/TransactionRules/Actions/ConvertToDepositTest.php b/tests/Unit/TransactionRules/Actions/ConvertToDepositTest.php
index d040a415c8..0deb03cdea 100644
--- a/tests/Unit/TransactionRules/Actions/ConvertToDepositTest.php
+++ b/tests/Unit/TransactionRules/Actions/ConvertToDepositTest.php
@@ -93,7 +93,8 @@ class ConvertToDepositTest extends TestCase
* @covers \FireflyIII\TransactionRules\Actions\ConvertToDeposit
*/
public function testActWithdrawal()
- {$this->markTestIncomplete('Needs to be rewritten for v4.8.0');
+ {
+ $this->markTestIncomplete('Needs to be rewritten for v4.8.0');
return;
$revenue = $this->getRandomRevenue();
diff --git a/tests/Unit/TransactionRules/Actions/ConvertToTransferTest.php b/tests/Unit/TransactionRules/Actions/ConvertToTransferTest.php
index 4a879956a7..92d8c027c5 100644
--- a/tests/Unit/TransactionRules/Actions/ConvertToTransferTest.php
+++ b/tests/Unit/TransactionRules/Actions/ConvertToTransferTest.php
@@ -55,7 +55,8 @@ class ConvertToTransferTest extends TestCase
* @covers \FireflyIII\TransactionRules\Actions\ConvertToTransfer
*/
public function testActDeposit(): void
- {$this->markTestIncomplete('Needs to be rewritten for v4.8.0');
+ {
+ $this->markTestIncomplete('Needs to be rewritten for v4.8.0');
return;
$deposit = $this->getRandomDeposit();
diff --git a/tests/Unit/TransactionRules/Actions/ConvertToWithdrawalTest.php b/tests/Unit/TransactionRules/Actions/ConvertToWithdrawalTest.php
index dcfc72f2bd..80cb65f845 100644
--- a/tests/Unit/TransactionRules/Actions/ConvertToWithdrawalTest.php
+++ b/tests/Unit/TransactionRules/Actions/ConvertToWithdrawalTest.php
@@ -54,7 +54,8 @@ class ConvertToWithdrawalTest extends TestCase
* @covers \FireflyIII\TransactionRules\Actions\ConvertToWithdrawal
*/
public function testActDeposit()
- {$this->markTestIncomplete('Needs to be rewritten for v4.8.0');
+ {
+ $this->markTestIncomplete('Needs to be rewritten for v4.8.0');
return;
$expense = $this->getRandomExpense();