-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #123 from bunq/optimise_test_framework_auto_topup_…
…#120 Optimise test framework auto topup #120
- Loading branch information
Showing
3 changed files
with
59 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,8 @@ | |
use bunq\Model\Generated\Endpoint\Avatar; | ||
use bunq\Model\Generated\Endpoint\CashRegister; | ||
use bunq\Model\Generated\Endpoint\MonetaryAccountBank; | ||
use bunq\Model\Generated\Endpoint\RequestInquiry; | ||
use bunq\Model\Generated\Object\Amount; | ||
use bunq\Model\Generated\Object\Pointer; | ||
use bunq\Util\BunqEnumApiEnvironmentType; | ||
use bunq\Util\FileUtil; | ||
|
@@ -36,7 +38,7 @@ class BunqSdkTestBase extends TestCase | |
/** | ||
* MonetaryAccount constants. | ||
*/ | ||
const MOMENTARY_ACCOUNT_CURRENCY = 'EUR'; | ||
const MONETARY_ACCOUNT_CURRENCY = 'EUR'; | ||
const MONETARY_ACCOUNT_DESCRIPTION = 'test account php'; | ||
const MONETARY_ACCOUNT_BALANCE_THRESHOLD = 0.00; | ||
|
||
|
@@ -75,6 +77,13 @@ class BunqSdkTestBase extends TestCase | |
*/ | ||
protected $cashRegister; | ||
|
||
/** | ||
* Spending money constants. | ||
*/ | ||
const SPENDING_MONEY_AMOUNT = '500'; | ||
const SPENDING_MONEY_RECIPIENT = '[email protected]'; | ||
const SPENDING_MONEY_DESCRIPTION = 'sdk php test, thanks daddy <3'; | ||
|
||
/** | ||
*/ | ||
public static function setUpBeforeClass() | ||
|
@@ -100,6 +109,9 @@ protected static function createApiContext() | |
protected function setUp() | ||
{ | ||
$this->setSecondMonetaryAccountBank(); | ||
$this->requestSpendingMoney(); | ||
sleep(0.5); // ensure requests are auto accepted. | ||
BunqContext::getUserContext()->refreshUserContext(); | ||
} | ||
|
||
/** | ||
|
@@ -144,13 +156,33 @@ protected function getAttachmentDescription(): string | |
private function setSecondMonetaryAccountBank() | ||
{ | ||
$createdId = MonetaryAccountBank::create( | ||
self::MOMENTARY_ACCOUNT_CURRENCY, | ||
self::MONETARY_ACCOUNT_CURRENCY, | ||
self::MONETARY_ACCOUNT_DESCRIPTION | ||
); | ||
|
||
$this->secondMonetaryAccountBank = MonetaryAccountBank::get($createdId->getValue())->getValue(); | ||
} | ||
|
||
/** | ||
*/ | ||
private function requestSpendingMoney() | ||
{ | ||
RequestInquiry::create( | ||
new Amount(self::SPENDING_MONEY_AMOUNT, self::MONETARY_ACCOUNT_CURRENCY), | ||
new Pointer(self::POINTER_TYPE_EMAIL, self::SPENDING_MONEY_RECIPIENT), | ||
self::SPENDING_MONEY_DESCRIPTION, | ||
false | ||
); | ||
|
||
RequestInquiry::create( | ||
new Amount(self::SPENDING_MONEY_AMOUNT, self::MONETARY_ACCOUNT_CURRENCY), | ||
new Pointer(self::POINTER_TYPE_EMAIL, self::SPENDING_MONEY_RECIPIENT), | ||
self::SPENDING_MONEY_DESCRIPTION, | ||
false, | ||
$this->getSecondMonetaryAccountId() | ||
); | ||
} | ||
|
||
/** | ||
* @return Pointer | ||
* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters