Code cleanup

This commit is contained in:
James Cole 2019-08-17 10:54:16 +02:00
parent 1974d5f1e3
commit 6d1bfd3956
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
11 changed files with 31 additions and 20 deletions

View File

@ -38,6 +38,7 @@ use Tests\TestCase;
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveClassLength)
*/
class RecurrenceControllerTest extends TestCase
{

View File

@ -60,6 +60,7 @@ class CategoryControllerTest extends TestCase
*
* @param string $range
* @throws FireflyException
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function testAll(string $range): void
{

View File

@ -52,6 +52,7 @@ use Tests\TestCase;
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings(PHPMD.TooManyMethods)
*/
class ReportControllerTest extends TestCase
{

View File

@ -67,6 +67,7 @@ use RuntimeException;
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
*/
abstract class TestCase extends BaseTestCase
{

View File

@ -50,6 +50,8 @@ use Tests\TestCase;
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveClassLength)
*
*/
class ImportArrayStorageTest extends TestCase
{

View File

@ -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
{

View File

@ -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();
}
/**

View File

@ -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);

View File

@ -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
{

View File

@ -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' => [

View File

@ -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;
}