@@ -67,6 +67,13 @@ class BunqSdkTestBase extends TestCase
67
67
*/
68
68
const INDEX_FIRST = 0 ;
69
69
70
+ /**
71
+ * Spending money constants.
72
+ */
73
+ const SPENDING_MONEY_AMOUNT = '500 ' ;
74
+ const SPENDING_MONEY_RECIPIENT = 'sugardaddy@bunq.com ' ;
75
+ const SPENDING_MONEY_DESCRIPTION = 'sdk php test, thanks daddy <3 ' ;
76
+
70
77
/**
71
78
* @var MonetaryAccountBank
72
79
*/
@@ -77,13 +84,6 @@ class BunqSdkTestBase extends TestCase
77
84
*/
78
85
protected $ cashRegister ;
79
86
80
- /**
81
- * Spending money constants.
82
- */
83
- const SPENDING_MONEY_AMOUNT = '500 ' ;
84
- const SPENDING_MONEY_RECIPIENT = 'sugardaddy@bunq.com ' ;
85
- const SPENDING_MONEY_DESCRIPTION = 'sdk php test, thanks daddy <3 ' ;
86
-
87
87
/**
88
88
*/
89
89
public static function setUpBeforeClass ()
@@ -112,43 +112,6 @@ protected function setUp()
112
112
BunqContext::getUserContext ()->refreshUserContext ();
113
113
}
114
114
115
- /**
116
- */
117
- private function setCashRegister ()
118
- {
119
- $ attachmentUuid = AttachmentPublic::create (
120
- FileUtil::getFileContents (__DIR__ . self ::FILE_PATH_AVATAR ),
121
- [
122
- ApiClient::HEADER_CONTENT_TYPE => $ this ->getAttachmentContentType (),
123
- ApiClient::HEADER_ATTACHMENT_DESCRIPTION => $ this ->getAttachmentDescription (),
124
- ]
125
- );
126
- $ avatarUuid = Avatar::create ($ attachmentUuid ->getValue ());
127
- $ cashRegisterId = CashRegister::create (
128
- self ::CASH_REGISTER_NAME ,
129
- self ::CASH_REGISTER_STATUS ,
130
- $ avatarUuid ->getValue ()
131
- );
132
-
133
- $ this ->cashRegister = CashRegister::get ($ cashRegisterId ->getValue ());
134
- }
135
-
136
- /**
137
- * @return string
138
- */
139
- protected function getAttachmentContentType (): string
140
- {
141
- return self ::ATTACHMENT_CONTENT_TYPE ;
142
- }
143
-
144
- /**
145
- * @return string
146
- */
147
- protected function getAttachmentDescription (): string
148
- {
149
- return self ::ATTACHMENT_DESCRIPTION ;
150
- }
151
-
152
115
/**
153
116
*/
154
117
private function setSecondMonetaryAccountBank ()
@@ -181,6 +144,14 @@ private function requestSpendingMoney()
181
144
);
182
145
}
183
146
147
+ /**
148
+ * @return int
149
+ */
150
+ protected function getSecondMonetaryAccountId (): int
151
+ {
152
+ return $ this ->secondMonetaryAccountBank ->getId ();
153
+ }
154
+
184
155
/**
185
156
* @return Pointer
186
157
*
@@ -234,14 +205,6 @@ protected function getPointerUserBravo(): Pointer
234
205
);
235
206
}
236
207
237
- /**
238
- * @return int
239
- */
240
- protected function getSecondMonetaryAccountId (): int
241
- {
242
- return $ this ->secondMonetaryAccountBank ->getId ();
243
- }
244
-
245
208
/**
246
209
* @return int
247
210
*/
@@ -255,13 +218,40 @@ protected function getCashRegisterId(): int
255
218
}
256
219
257
220
/**
258
- * @return bool
259
221
*/
260
- protected function isMonetaryAccountBalanceSufficient (): bool
222
+ private function setCashRegister ()
261
223
{
262
- $ balance = floatval (BunqContext::getUserContext ()->getPrimaryMonetaryAccount ()->getBalance ()->getValue ());
224
+ $ attachmentUuid = AttachmentPublic::create (
225
+ FileUtil::getFileContents (__DIR__ . self ::FILE_PATH_AVATAR ),
226
+ [
227
+ ApiClient::HEADER_CONTENT_TYPE => $ this ->getAttachmentContentType (),
228
+ ApiClient::HEADER_ATTACHMENT_DESCRIPTION => $ this ->getAttachmentDescription (),
229
+ ]
230
+ );
231
+ $ avatarUuid = Avatar::create ($ attachmentUuid ->getValue ());
232
+ $ cashRegisterId = CashRegister::create (
233
+ self ::CASH_REGISTER_NAME ,
234
+ self ::CASH_REGISTER_STATUS ,
235
+ $ avatarUuid ->getValue ()
236
+ );
263
237
264
- return $ balance > self ::MONETARY_ACCOUNT_BALANCE_THRESHOLD ;
238
+ $ this ->cashRegister = CashRegister::get ($ cashRegisterId ->getValue ());
239
+ }
240
+
241
+ /**
242
+ * @return string
243
+ */
244
+ protected function getAttachmentContentType (): string
245
+ {
246
+ return self ::ATTACHMENT_CONTENT_TYPE ;
247
+ }
248
+
249
+ /**
250
+ * @return string
251
+ */
252
+ protected function getAttachmentDescription (): string
253
+ {
254
+ return self ::ATTACHMENT_DESCRIPTION ;
265
255
}
266
256
267
257
/**
@@ -275,4 +265,14 @@ protected function skipTestIfNeededDueToInsufficientBalance(): bool
275
265
276
266
return true ;
277
267
}
268
+
269
+ /**
270
+ * @return bool
271
+ */
272
+ protected function isMonetaryAccountBalanceSufficient (): bool
273
+ {
274
+ $ balance = floatval (BunqContext::getUserContext ()->getPrimaryMonetaryAccount ()->getBalance ()->getValue ());
275
+
276
+ return $ balance > self ::MONETARY_ACCOUNT_BALANCE_THRESHOLD ;
277
+ }
278
278
}
0 commit comments