mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-30 10:47:06 -06:00
Code cleanup
This commit is contained in:
parent
1974d5f1e3
commit
6d1bfd3956
@ -38,6 +38,7 @@ use Tests\TestCase;
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
|
||||
* @SuppressWarnings(PHPMD.ExcessiveClassLength)
|
||||
*/
|
||||
class RecurrenceControllerTest extends TestCase
|
||||
{
|
||||
|
@ -60,6 +60,7 @@ class CategoryControllerTest extends TestCase
|
||||
*
|
||||
* @param string $range
|
||||
* @throws FireflyException
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||
*/
|
||||
public function testAll(string $range): void
|
||||
{
|
||||
|
@ -52,6 +52,7 @@ use Tests\TestCase;
|
||||
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
* @SuppressWarnings(PHPMD.TooManyMethods)
|
||||
*/
|
||||
class ReportControllerTest extends TestCase
|
||||
{
|
||||
|
@ -67,6 +67,7 @@ use RuntimeException;
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
|
||||
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
|
||||
*/
|
||||
abstract class TestCase extends BaseTestCase
|
||||
{
|
||||
|
@ -50,6 +50,8 @@ use Tests\TestCase;
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
|
||||
* @SuppressWarnings(PHPMD.ExcessiveClassLength)
|
||||
*
|
||||
*/
|
||||
class ImportArrayStorageTest extends TestCase
|
||||
{
|
||||
|
@ -51,6 +51,9 @@ use Tests\TestCase;
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
|
||||
* @SuppressWarnings(PHPMD.TooManyMethods)
|
||||
* @SuppressWarnings(PHPMD.ExcessiveClassLength)
|
||||
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
|
||||
*/
|
||||
class BinderTest extends TestCase
|
||||
{
|
||||
|
@ -78,8 +78,8 @@ class AccountDestroyServiceTest extends TestCase
|
||||
'virtual_balance' => '0', 'iban' => null, 'active' => true]
|
||||
);
|
||||
|
||||
$recurrence = $this->getRandomRecurrence();
|
||||
$recurrenceTransaction = RecurrenceTransaction::create(
|
||||
$recurrence = $this->getRandomRecurrence();
|
||||
$transaction = RecurrenceTransaction::create(
|
||||
[
|
||||
'recurrence_id' => $recurrence->id,
|
||||
'transaction_currency_id' => $this->getEuro()->id,
|
||||
@ -91,7 +91,7 @@ class AccountDestroyServiceTest extends TestCase
|
||||
);
|
||||
|
||||
$recService->shouldReceive('destroyById')->once()
|
||||
->withAnyArgs([$recurrenceTransaction->id]);
|
||||
->withAnyArgs([$transaction->id]);
|
||||
|
||||
/** @var AccountDestroyService $service */
|
||||
$service = app(AccountDestroyService::class);
|
||||
@ -99,7 +99,7 @@ class AccountDestroyServiceTest extends TestCase
|
||||
|
||||
$this->assertDatabaseMissing('accounts', ['id' => $account->id, 'deleted_at' => null]);
|
||||
|
||||
$recurrenceTransaction->forceDelete();
|
||||
$transaction->forceDelete();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -142,9 +142,9 @@ class ChooseLoginHandlerTest extends TestCase
|
||||
public function testConfigureJobCustomer(): void
|
||||
{
|
||||
// fake Spectre customer:
|
||||
$fakeCustomerPreference = new Preference;
|
||||
$fakeCustomerPreference->name = 'spectre_customer';
|
||||
$fakeCustomerPreference->data = [
|
||||
$fakePref = new Preference;
|
||||
$fakePref->name = 'spectre_customer';
|
||||
$fakePref->data = [
|
||||
'id' => 1,
|
||||
'identifier' => 'fake',
|
||||
'secret' => 'Dumbledore dies',
|
||||
@ -167,7 +167,7 @@ class ChooseLoginHandlerTest extends TestCase
|
||||
|
||||
// should try to grab customer from preferences:
|
||||
Preferences::shouldReceive('getForUser')->withArgs([Mockery::any(), 'spectre_customer', null])
|
||||
->andReturn($fakeCustomerPreference)->once();
|
||||
->andReturn($fakePref)->once();
|
||||
|
||||
// mock stuff
|
||||
$ctRequest = $this->mock(CreateTokenRequest::class);
|
||||
|
@ -35,6 +35,8 @@ use Tests\TestCase;
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
|
||||
* @SuppressWarnings(PHPMD.TooManyMethods)
|
||||
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
|
||||
*/
|
||||
class ImportTransactionTest extends TestCase
|
||||
{
|
||||
|
@ -85,7 +85,7 @@ class StageNewHandlerTest extends TestCase
|
||||
// create fake bunq object:
|
||||
$setting = new MonetaryAccountSetting(null, null, null);
|
||||
$mab = new BunqMonetaryAccountBank('EUR', 'Some descr', null, null, null, null, null, null, null, null);
|
||||
$ma = new BunqMonetaryAccount;
|
||||
$monAcc = new BunqMonetaryAccount;
|
||||
$alias = new Pointer('a', 'b', null);
|
||||
|
||||
|
||||
@ -96,10 +96,10 @@ class StageNewHandlerTest extends TestCase
|
||||
$setting->setColor('FFFFFF');
|
||||
$mab->setSetting($setting);
|
||||
$mab->setAlias([$alias]);
|
||||
$ma->setMonetaryAccountBank($mab);
|
||||
$monAcc->setMonetaryAccountBank($mab);
|
||||
|
||||
// response list.
|
||||
$list = new BunqResponseMonetaryAccountList([$ma], []);
|
||||
$list = new BunqResponseMonetaryAccountList([$monAcc], []);
|
||||
|
||||
$expectedConfig = [
|
||||
'accounts' => [
|
||||
@ -172,7 +172,7 @@ class StageNewHandlerTest extends TestCase
|
||||
// create fake bunq object:
|
||||
$setting = new MonetaryAccountSetting(null, null, null);
|
||||
$maj = new MonetaryAccountJoint('EUR', [], 'Some descr', null, null, null, null, null, null, null, null);
|
||||
$ma = new BunqMonetaryAccount;
|
||||
$monAcc = new BunqMonetaryAccount;
|
||||
$alias = new Pointer('a', 'b', null);
|
||||
$labelUser = new LabelUser('x', 'James', 'NL');
|
||||
$coOwner = new CoOwner($alias);
|
||||
@ -186,11 +186,11 @@ class StageNewHandlerTest extends TestCase
|
||||
$maj->setSetting($setting);
|
||||
$maj->setAlias([$alias]);
|
||||
$maj->setAllCoOwner([$coOwner]);
|
||||
$ma->setMonetaryAccountJoint($maj);
|
||||
$monAcc->setMonetaryAccountJoint($maj);
|
||||
$coOwner->setAlias($labelUser);
|
||||
|
||||
// response list.
|
||||
$list = new BunqResponseMonetaryAccountList([$ma], []);
|
||||
$list = new BunqResponseMonetaryAccountList([$monAcc], []);
|
||||
|
||||
$expectedConfig = [
|
||||
'accounts' => [
|
||||
@ -264,7 +264,7 @@ class StageNewHandlerTest extends TestCase
|
||||
// create fake bunq object:
|
||||
$setting = new MonetaryAccountSetting(null, null, null);
|
||||
$mal = new MonetaryAccountLight('EUR', 'Some descr', null, null, null, null, null, null, null, null);
|
||||
$ma = new BunqMonetaryAccount;
|
||||
$monAcc = new BunqMonetaryAccount;
|
||||
$alias = new Pointer('a', 'b', null);
|
||||
|
||||
|
||||
@ -275,10 +275,10 @@ class StageNewHandlerTest extends TestCase
|
||||
$setting->setColor('FFFFFF');
|
||||
$mal->setSetting($setting);
|
||||
$mal->setAlias([$alias]);
|
||||
$ma->setMonetaryAccountLight($mal);
|
||||
$monAcc->setMonetaryAccountLight($mal);
|
||||
|
||||
// response list.
|
||||
$list = new BunqResponseMonetaryAccountList([$ma], []);
|
||||
$list = new BunqResponseMonetaryAccountList([$monAcc], []);
|
||||
|
||||
$expectedConfig = [
|
||||
'accounts' => [
|
||||
|
@ -125,14 +125,14 @@ class MappedValuesValidatorTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @param int $objectId
|
||||
*
|
||||
* @return stdClass
|
||||
*/
|
||||
private function objectWithId(int $id): stdClass
|
||||
private function objectWithId(int $objectId): stdClass
|
||||
{
|
||||
$obj = new stdClass();
|
||||
$obj->id = $id;
|
||||
$obj->id = $objectId;
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user