Skip to content

Commit

Permalink
Rearranged code. (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
OGKevin committed Nov 14, 2017
1 parent 9eb7f4c commit 905e80c
Showing 1 changed file with 23 additions and 40 deletions.
63 changes: 23 additions & 40 deletions tests/Model/Generated/Object/NotificationUrlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,27 +72,6 @@ class NotificationUrlTest extends BunqSdkTestBase
*/
const KEY_NOTIFICATION_URL_MODEL = 'NotificationUrl';

/**
* @param string $expectedJsonFileName
* @param string $classNameExpected
* @param string $referencedObjectGetterName
*/
private function executeNotificationUrlTest(
string $expectedJsonFileName,
string $classNameExpected,
string $referencedObjectGetterName
) {
$jsonExpectedString = FileUtil::getFileContents($expectedJsonFileName);
$notificationUrl = $this->getNotificationUrlFromJson($jsonExpectedString);

$model = $notificationUrl->getObject()->$referencedObjectGetterName();
$referencedModel = $notificationUrl->getObject()->getReferencedObject();

static::assertNotNull($model);
static::assertNotNull($referencedModel);
static::assertInstanceOf($classNameExpected, $referencedModel);
}

/**
*/
public function testMutationModel()
Expand Down Expand Up @@ -125,7 +104,7 @@ public function testGetMonetaryAccountModel()
self::GETTER_MONETARY_ACCOUNT_BANK
);
}

/**
*/
public function testPaymentBatchModel()
Expand Down Expand Up @@ -169,7 +148,7 @@ public function testSchedulePaymentModel()
self::GETTER_SCHEDULE_PAYMENT
);
}

/**
*/
public function testShareInviteBankResponse()
Expand Down Expand Up @@ -236,6 +215,27 @@ public function testDraftPaymentModel()
);
}

/**
* @param string $expectedJsonFileName
* @param string $classNameExpected
* @param string $referencedObjectGetterName
*/
private function executeNotificationUrlTest(
string $expectedJsonFileName,
string $classNameExpected,
string $referencedObjectGetterName
) {
$jsonExpectedString = FileUtil::getFileContents($expectedJsonFileName);
$notificationUrl = $this->getNotificationUrlFromJson($jsonExpectedString);

$model = $notificationUrl->getObject()->$referencedObjectGetterName();
$referencedModel = $notificationUrl->getObject()->getReferencedObject();

static::assertNotNull($model);
static::assertNotNull($referencedModel);
static::assertInstanceOf($classNameExpected, $referencedModel);
}

/**
* @param string $jsonString
*
Expand All @@ -256,23 +256,6 @@ private function getNotificationUrlFromJson(string $jsonString): NotificationUrl
return $notificationUrl;
}

/**
* @param BunqModel $model
*
* @return NotificationUrl
* @throws BunqException
*/
private function assertInstanceOfNotificationUrl(BunqModel $model): NotificationUrl
{
static::assertInstanceOf(NotificationUrl::class, $model);

if ($model instanceof NotificationUrl) {
return $model;
}

throw new BunqException(self::ASSERT_SHOULD_NOT_REACH_THIS_CODE_ERROR);
}

/**
* @param string[] $json
*
Expand Down

0 comments on commit 905e80c

Please sign in to comment.