New tests

This commit is contained in:
James Cole
2020-10-10 11:21:14 +02:00
parent 76cfdef27d
commit acfc976f6d
18 changed files with 199 additions and 237 deletions

View File

@@ -81,6 +81,8 @@ class CorrectOpeningBalanceCurrenciesTest extends TestCase
->expectsOutput(sprintf('Transaction journal #%d has no valid account. Cant fix this line.', $journal->id)) ->expectsOutput(sprintf('Transaction journal #%d has no valid account. Cant fix this line.', $journal->id))
//->expectsOutput('Cant fix this line.') //->expectsOutput('Cant fix this line.')
->assertExitCode(0); ->assertExitCode(0);
$journal->forceDelete();
} }
} }

View File

@@ -35,43 +35,16 @@ use Tests\TestCase;
/** /**
* Class CreateAccessTokensTest * Class CreateAccessTokensTest
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
*/ */
class CreateAccessTokensTest extends TestCase class CreateAccessTokensTest extends TestCase
{ {
/**
*
*/
public function setUp(): void
{
self::markTestIncomplete('Incomplete for refactor.');
return;
parent::setUp();
Log::info(sprintf('Now in %s.', get_class($this)));
}
/** /**
* @covers \FireflyIII\Console\Commands\Correction\CreateAccessTokens * @covers \FireflyIII\Console\Commands\Correction\CreateAccessTokens
*/ */
public function testHandle(): void public function testHandle(): void
{ {
$users = new Collection([$this->user()]); // remove preferences so token will be generated
$repository = $this->mock(UserRepositoryInterface::class); Preference::where('name','access_token')->delete();
// mock calls:
$repository->shouldReceive('all')->atLeast()->once()->andReturn($users);
// mock preferences thing:
Preferences::shouldReceive('getForUser')->withArgs([Mockery::any(), 'access_token', null])
->once()->andReturn(null);
// null means user object will generate one and store it.
Preferences::shouldReceive('setForUser')->withArgs([Mockery::any(), 'access_token', Mockery::any()])
->once();
$this->artisan('firefly-iii:create-access-tokens') $this->artisan('firefly-iii:create-access-tokens')
->expectsOutput(sprintf('Generated access token for user %s', $this->user()->email)) ->expectsOutput(sprintf('Generated access token for user %s', $this->user()->email))
@@ -83,20 +56,11 @@ class CreateAccessTokensTest extends TestCase
*/ */
public function testHandlePrefExists(): void public function testHandlePrefExists(): void
{ {
$users = new Collection([$this->user()]);
$repository = $this->mock(UserRepositoryInterface::class);
// mock calls:
$repository->shouldReceive('all')->atLeast()->once()->andReturn($users);
// mock preferences thing:
$preference = new Preference; $preference = new Preference;
$preference->data = '123'; $preference->data = '123';
Preferences::shouldReceive('getForUser')->withArgs([Mockery::any(), 'access_token', null]) $preference->name = 'access_token';
->once()->andReturn($preference); $preference->user_id = $this->user()->id;
$preference->save();
// null means user object will generate one and store it.
Preferences::shouldNotReceive('setForUser');
$this->artisan('firefly-iii:create-access-tokens') $this->artisan('firefly-iii:create-access-tokens')
->expectsOutput('All access tokens OK!') ->expectsOutput('All access tokens OK!')

View File

@@ -30,23 +30,9 @@ use Tests\TestCase;
/** /**
* Class CreateLinkTypesTest * Class CreateLinkTypesTest
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
*/ */
class CreateLinkTypesTest extends TestCase class CreateLinkTypesTest extends TestCase
{ {
/**
*
*/
public function setUp(): void
{
self::markTestIncomplete('Incomplete for refactor.');
return;
parent::setUp();
Log::info(sprintf('Now in %s.', get_class($this)));
}
/** /**
* @covers \FireflyIII\Console\Commands\Correction\CreateLinkTypes * @covers \FireflyIII\Console\Commands\Correction\CreateLinkTypes

View File

@@ -30,24 +30,9 @@ use Tests\TestCase;
/** /**
* Class DeleteEmptyGroupsTest * Class DeleteEmptyGroupsTest
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
*/ */
class DeleteEmptyGroupsTest extends TestCase class DeleteEmptyGroupsTest extends TestCase
{ {
/**
*
*/
public function setUp(): void
{
self::markTestIncomplete('Incomplete for refactor.');
return;
parent::setUp();
Log::info(sprintf('Now in %s.', get_class($this)));
}
/** /**
* @covers \FireflyIII\Console\Commands\Correction\DeleteEmptyGroups * @covers \FireflyIII\Console\Commands\Correction\DeleteEmptyGroups
*/ */

View File

@@ -31,25 +31,9 @@ use Tests\TestCase;
/** /**
* Class DeleteEmptyJournalsTest * Class DeleteEmptyJournalsTest
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
*/ */
class DeleteEmptyJournalsTest extends TestCase class DeleteEmptyJournalsTest extends TestCase
{ {
/**
*
*/
public function setUp(): void
{
self::markTestIncomplete('Incomplete for refactor.');
return;
parent::setUp();
Log::info(sprintf('Now in %s.', get_class($this)));
}
/** /**
* @covers \FireflyIII\Console\Commands\Correction\DeleteEmptyJournals * @covers \FireflyIII\Console\Commands\Correction\DeleteEmptyJournals
*/ */

View File

@@ -32,24 +32,9 @@ use Tests\TestCase;
/** /**
* Class DeleteOrphanedTransactionsTest * Class DeleteOrphanedTransactionsTest
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
*/ */
class DeleteOrphanedTransactionsTest extends TestCase class DeleteOrphanedTransactionsTest extends TestCase
{ {
/**
*
*/
public function setUp(): void
{
self::markTestIncomplete('Incomplete for refactor.');
return;
parent::setUp();
Log::info(sprintf('Now in %s.', get_class($this)));
}
/** /**
* @covers \FireflyIII\Console\Commands\Correction\DeleteOrphanedTransactions * @covers \FireflyIII\Console\Commands\Correction\DeleteOrphanedTransactions
*/ */

View File

@@ -31,24 +31,9 @@ use Tests\TestCase;
/** /**
* Class DeleteZeroAmountTest * Class DeleteZeroAmountTest
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
*/ */
class DeleteZeroAmountTest extends TestCase class DeleteZeroAmountTest extends TestCase
{ {
/**
*
*/
public function setUp(): void
{
self::markTestIncomplete('Incomplete for refactor.');
return;
parent::setUp();
Log::info(sprintf('Now in %s.', get_class($this)));
}
/** /**
* @covers \FireflyIII\Console\Commands\Correction\DeleteZeroAmount * @covers \FireflyIII\Console\Commands\Correction\DeleteZeroAmount
*/ */

View File

@@ -26,35 +26,18 @@ namespace Tests\Feature\Console\Commands\Correction;
use FireflyIII\Models\BudgetLimit; use FireflyIII\Models\BudgetLimit;
use FireflyIII\Models\TransactionCurrency; use FireflyIII\Models\TransactionCurrency;
use Log;
use Tests\TestCase; use Tests\TestCase;
/** /**
* Class EnableCurrenciesTest * Class EnableCurrenciesTest
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
*/ */
class EnableCurrenciesTest extends TestCase class EnableCurrenciesTest extends TestCase
{ {
/**
*
*/
public function setUp(): void
{
self::markTestIncomplete('Incomplete for refactor.');
return;
parent::setUp();
Log::info(sprintf('Now in %s.', get_class($this)));
}
/** /**
* @covers \FireflyIII\Console\Commands\Correction\EnableCurrencies * @covers \FireflyIII\Console\Commands\Correction\EnableCurrencies
*/ */
public function testHandle(): void public function testHandleEnabled(): void
{ {
// assume the current database is intact.
$count = TransactionCurrency::where('enabled', 1)->count(); $count = TransactionCurrency::where('enabled', 1)->count();
$this->artisan('firefly-iii:enable-currencies') $this->artisan('firefly-iii:enable-currencies')
@@ -72,9 +55,13 @@ class EnableCurrenciesTest extends TestCase
{ {
// find a disabled currency, update a budget limit with it. // find a disabled currency, update a budget limit with it.
$currency = TransactionCurrency::where('enabled', 0)->first(); $currency = TransactionCurrency::where('enabled', 0)->first();
/** @var BudgetLimit $budgetLimit */ $budget = $this->getRandomBudget();
$budgetLimit = BudgetLimit::inRandomOrder()->first(); $budgetLimit = new BudgetLimit;
$budgetLimit->transaction_currency_id = $currency->id; $budgetLimit->transaction_currency_id = $currency->id;
$budgetLimit->budget_id = $budget->id;
$budgetLimit->start_date = '2020-01-01';
$budgetLimit->end_date = '2020-01-02';
$budgetLimit->amount = '4';
$budgetLimit->save(); $budgetLimit->save();
// assume the current database is intact. // assume the current database is intact.
@@ -85,6 +72,7 @@ class EnableCurrenciesTest extends TestCase
// assume its been enabled. // assume its been enabled.
$this->assertCount($count + 1, TransactionCurrency::where('enabled', 1)->get()); $this->assertCount($count + 1, TransactionCurrency::where('enabled', 1)->get());
$budgetLimit->forceDelete();
} }
} }

View File

@@ -0,0 +1,47 @@
<?php
/*
* FixAccountOrderTest.php
* Copyright (c) 2020 james@firefly-iii.org
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace Tests\Feature\Console\Commands\Correction;
use DB;
use FireflyIII\Models\Account;
use Tests\TestCase;
class FixAccountOrderTest extends TestCase
{
/**
* @covers \FireflyIII\Console\Commands\Correction\FixAccountOrder
*/
public function testHandle(): void
{
// reset all asset accounts accounts:
Account::select()->update(['order' => 0]);
$this->artisan('firefly-iii:fix-account-order')
->assertExitCode(0);
$this->assertCount(0, Account::where('order', '=',0)->get());
}
}

View File

@@ -29,36 +29,19 @@ use FireflyIII\Models\AccountType;
use FireflyIII\Models\Transaction; use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\TransactionType; use FireflyIII\Models\TransactionType;
use Log;
use Tests\TestCase; use Tests\TestCase;
/** /**
* Class FixAccountTypesTest * Class FixAccountTypesTest
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
*/ */
class FixAccountTypesTest extends TestCase class FixAccountTypesTest extends TestCase
{ {
/**
*
*/
public function setUp(): void
{
self::markTestIncomplete('Incomplete for refactor.');
return;
parent::setUp();
Log::info(sprintf('Now in %s.', get_class($this)));
}
/** /**
* @covers \FireflyIII\Console\Commands\Correction\FixAccountTypes * @covers \FireflyIII\Console\Commands\Correction\FixAccountTypes
*/ */
public function testHandleUneven(): void public function testHandleUneven(): void
{ {
$this->mock(AccountFactory::class); $source = $this->getRandomDebt();
$source = $this->user()->accounts()->where('name', 'Another DUO Student loans')->first();
$type = TransactionType::where('type', TransactionType::WITHDRAWAL)->first(); $type = TransactionType::where('type', TransactionType::WITHDRAWAL)->first();
$journal = TransactionJournal::create( $journal = TransactionJournal::create(
[ [
@@ -91,8 +74,6 @@ class FixAccountTypesTest extends TestCase
*/ */
public function testHandle(): void public function testHandle(): void
{ {
$this->mock(AccountFactory::class);
// assume there's nothing to fix. // assume there's nothing to fix.
$this->artisan('firefly-iii:fix-account-types') $this->artisan('firefly-iii:fix-account-types')
->expectsOutput('All account types are OK!') ->expectsOutput('All account types are OK!')
@@ -107,8 +88,8 @@ class FixAccountTypesTest extends TestCase
public function testHandleWithdrawalLoanLoan(): void public function testHandleWithdrawalLoanLoan(): void
{ {
$this->mock(AccountFactory::class); $this->mock(AccountFactory::class);
$source = $this->user()->accounts()->where('name', 'Another DUO Student loans')->first(); $source = $this->getRandomLoan();
$destination = $this->user()->accounts()->where('name', 'DUO Student loans')->first(); $destination = $this->getRandomLoan($source->id);
$type = TransactionType::where('type', TransactionType::WITHDRAWAL)->first(); $type = TransactionType::where('type', TransactionType::WITHDRAWAL)->first();
$journal = TransactionJournal::create( $journal = TransactionJournal::create(
[ [
@@ -143,8 +124,6 @@ class FixAccountTypesTest extends TestCase
->assertExitCode(0); ->assertExitCode(0);
// since system cant handle this problem, dont look for changed transactions. // since system cant handle this problem, dont look for changed transactions.
$one->forceDelete(); $one->forceDelete();
$two->forceDelete(); $two->forceDelete();
$journal->forceDelete(); $journal->forceDelete();
@@ -157,7 +136,7 @@ class FixAccountTypesTest extends TestCase
{ {
$this->mock(AccountFactory::class); $this->mock(AccountFactory::class);
$source = $this->getRandomAsset(); $source = $this->getRandomAsset();
$destination = $this->user()->accounts()->where('name', 'DUO Student loans')->first(); $destination = $this->getRandomLoan();
$type = TransactionType::where('type', TransactionType::TRANSFER)->first(); $type = TransactionType::where('type', TransactionType::TRANSFER)->first();
$withdrawal = TransactionType::where('type', TransactionType::WITHDRAWAL)->first(); $withdrawal = TransactionType::where('type', TransactionType::WITHDRAWAL)->first();
$journal = TransactionJournal::create( $journal = TransactionJournal::create(
@@ -205,7 +184,7 @@ class FixAccountTypesTest extends TestCase
public function testHandleTransferLoanAsset(): void public function testHandleTransferLoanAsset(): void
{ {
$this->mock(AccountFactory::class); $this->mock(AccountFactory::class);
$source = $this->user()->accounts()->where('name', 'DUO Student loans')->first(); $source = $this->getRandomLoan();
$destination = $this->getRandomAsset(); $destination = $this->getRandomAsset();
$type = TransactionType::where('type', TransactionType::TRANSFER)->first(); $type = TransactionType::where('type', TransactionType::TRANSFER)->first();
$deposit = TransactionType::where('type', TransactionType::DEPOSIT)->first(); $deposit = TransactionType::where('type', TransactionType::DEPOSIT)->first();

View File

@@ -0,0 +1,48 @@
<?php
/*
* FixGroupAccountsTest.php
* Copyright (c) 2020 james@firefly-iii.org
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace Tests\Feature\Console\Commands\Correction;
use Tests\TestCase;
/**
* Class FixGroupAccountsTest
* @package Tests\Feature\Console\Commands\Correction
*/
class FixGroupAccountsTest extends TestCase
{
/**
* @covers \FireflyIII\Console\Commands\Correction\FixGroupAccounts
*/
public function testHandle(): void
{
// basic group with multiple journals, should trigger event.
$this->artisan('firefly-iii:unify-group-accounts')
->expectsOutput('Updated inconsistent transaction groups.')
->assertExitCode(0);
// This just triggers the events. No real test.
}
}

View File

@@ -0,0 +1,42 @@
<?php
/*
* FixLongDescriptionsTest.php
* Copyright (c) 2020 james@firefly-iii.org
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace Tests\Feature\Console\Commands\Correction;
use Tests\TestCase;
/**
* Class FixLongDescriptionsTest
*/
class FixLongDescriptionsTest extends TestCase
{
/**
* @covers \FireflyIII\Console\Commands\Correction\FixLongDescriptions
*/
public function testHandle(): void
{
$this->artisan('firefly-iii:fix-long-descriptions')
->expectsOutput('Verified all transaction group and journal title lengths')
->assertExitCode(0);
}
}

View File

@@ -31,24 +31,9 @@ use Tests\TestCase;
/** /**
* Class FixPiggiesTest * Class FixPiggiesTest
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
*/ */
class FixPiggiesTest extends TestCase class FixPiggiesTest extends TestCase
{ {
/**
*
*/
public function setUp(): void
{
self::markTestIncomplete('Incomplete for refactor.');
return;
parent::setUp();
Log::info(sprintf('Now in %s.', get_class($this)));
}
/** /**
* Null event. * Null event.
* *

View File

@@ -32,23 +32,9 @@ use Tests\TestCase;
/** /**
* Class FixUnevenAmountTest * Class FixUnevenAmountTest
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
*/ */
class FixUnevenAmountTest extends TestCase class FixUnevenAmountTest extends TestCase
{ {
/**
*
*/
public function setUp(): void
{
self::markTestIncomplete('Incomplete for refactor.');
return;
parent::setUp();
Log::info(sprintf('Now in %s.', get_class($this)));
}
/** /**
* @covers \FireflyIII\Console\Commands\Correction\FixUnevenAmount * @covers \FireflyIII\Console\Commands\Correction\FixUnevenAmount

View File

@@ -30,24 +30,10 @@ use Tests\TestCase;
/** /**
* Class RemoveBillsTest * Class RemoveBillsTest
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
*/ */
class RemoveBillsTest extends TestCase class RemoveBillsTest extends TestCase
{ {
/**
*
*/
public function setUp(): void
{
self::markTestIncomplete('Incomplete for refactor.');
return;
parent::setUp();
Log::info(sprintf('Now in %s.', get_class($this)));
}
/** /**
* @covers \FireflyIII\Console\Commands\Correction\RemoveBills * @covers \FireflyIII\Console\Commands\Correction\RemoveBills
@@ -67,7 +53,7 @@ class RemoveBillsTest extends TestCase
*/ */
public function testHandleWithdrawal(): void public function testHandleWithdrawal(): void
{ {
$bill = $this->user()->bills()->first(); $bill = $this->getRandomBill();
$journal = $this->getRandomDeposit(); $journal = $this->getRandomDeposit();
$journal->bill_id = $bill->id; $journal->bill_id = $bill->id;

View File

@@ -30,23 +30,9 @@ use Tests\TestCase;
/** /**
* Class RenameMetaFieldsTest * Class RenameMetaFieldsTest
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
*/ */
class RenameMetaFieldsTest extends TestCase class RenameMetaFieldsTest extends TestCase
{ {
/**
*
*/
public function setUp(): void
{
self::markTestIncomplete('Incomplete for refactor.');
return;
parent::setUp();
Log::info(sprintf('Now in %s.', get_class($this)));
}
/** /**
* @covers \FireflyIII\Console\Commands\Correction\RenameMetaFields * @covers \FireflyIII\Console\Commands\Correction\RenameMetaFields

View File

@@ -29,24 +29,9 @@ use Tests\TestCase;
/** /**
* Class TransferBudgetsTest * Class TransferBudgetsTest
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
*/ */
class TransferBudgetsTest extends TestCase class TransferBudgetsTest extends TestCase
{ {
/**
*
*/
public function setUp(): void
{
self::markTestIncomplete('Incomplete for refactor.');
return;
parent::setUp();
Log::info(sprintf('Now in %s.', get_class($this)));
}
/** /**
* @covers \FireflyIII\Console\Commands\Correction\TransferBudgets * @covers \FireflyIII\Console\Commands\Correction\TransferBudgets
*/ */
@@ -63,7 +48,7 @@ class TransferBudgetsTest extends TestCase
public function testHandleBudget(): void public function testHandleBudget(): void
{ {
$deposit = $this->getRandomDeposit(); $deposit = $this->getRandomDeposit();
$budget = $this->user()->budgets()->inRandomOrder()->first(); $budget = $this->getRandomBudget();
$deposit->budgets()->save($budget); $deposit->budgets()->save($budget);

View File

@@ -182,6 +182,45 @@ trait CollectsValues
return $this->getRandomAccount(AccountType::ASSET, $except); return $this->getRandomAccount(AccountType::ASSET, $except);
} }
/**
* @param int|null $except
*
* @return Account
*/
public function getRandomDebt(?int $except = null): Account
{
return $this->getRandomAccount(AccountType::DEBT, $except);
}
/**
* @param int|null $except
*
* @return Account
*/
public function getRandomLoan(?int $except = null): Account
{
return $this->getRandomAccount(AccountType::LOAN, $except);
}
/**
* @param int|null $except
*
* @return Account
*/
public function getRandomRevenue(?int $except = null): Account
{
return $this->getRandomAccount(AccountType::REVENUE, $except);
}
/**
* @param int|null $except
*
* @return Account
*/
public function getRandomExpense(?int $except = null): Account
{
return $this->getRandomAccount(AccountType::EXPENSE, $except);
}
/** /**
* @param string $type * @param string $type
* *