@@ -172,4 +172,155 @@ public function testSupportsUnstore()
172
172
$ this ->assertFalse (method_exists ($ this ->gateway , 'unstore ' ));
173
173
}
174
174
}
175
+
176
+ public function testAuthorizeParameters ()
177
+ {
178
+ if ($ this ->gateway ->supportsAuthorize ()) {
179
+ foreach ($ this ->gateway ->getDefaultParameters () as $ key => $ default ) {
180
+ // set property on gateway
181
+ $ getter = 'get ' .ucfirst ($ key );
182
+ $ setter = 'set ' .ucfirst ($ key );
183
+ $ value = uniqid ();
184
+ $ this ->gateway ->$ setter ($ value );
185
+
186
+ // request should have matching property, with correct value
187
+ $ request = $ this ->gateway ->authorize ();
188
+ $ this ->assertSame ($ value , $ request ->$ getter ());
189
+ }
190
+ }
191
+ }
192
+
193
+ public function testCompleteAuthorizeParameters ()
194
+ {
195
+ if ($ this ->gateway ->supportsCompleteAuthorize ()) {
196
+ foreach ($ this ->gateway ->getDefaultParameters () as $ key => $ default ) {
197
+ // set property on gateway
198
+ $ getter = 'get ' .ucfirst ($ key );
199
+ $ setter = 'set ' .ucfirst ($ key );
200
+ $ value = uniqid ();
201
+ $ this ->gateway ->$ setter ($ value );
202
+
203
+ // request should have matching property, with correct value
204
+ $ request = $ this ->gateway ->completeAuthorize ();
205
+ $ this ->assertSame ($ value , $ request ->$ getter ());
206
+ }
207
+ }
208
+ }
209
+
210
+ public function testCaptureParameters ()
211
+ {
212
+ if ($ this ->gateway ->supportsCapture ()) {
213
+ foreach ($ this ->gateway ->getDefaultParameters () as $ key => $ default ) {
214
+ // set property on gateway
215
+ $ getter = 'get ' .ucfirst ($ key );
216
+ $ setter = 'set ' .ucfirst ($ key );
217
+ $ value = uniqid ();
218
+ $ this ->gateway ->$ setter ($ value );
219
+
220
+ // request should have matching property, with correct value
221
+ $ request = $ this ->gateway ->capture ();
222
+ $ this ->assertSame ($ value , $ request ->$ getter ());
223
+ }
224
+ }
225
+ }
226
+
227
+ public function testPurchaseParameters ()
228
+ {
229
+ foreach ($ this ->gateway ->getDefaultParameters () as $ key => $ default ) {
230
+ // set property on gateway
231
+ $ getter = 'get ' .ucfirst ($ key );
232
+ $ setter = 'set ' .ucfirst ($ key );
233
+ $ value = uniqid ();
234
+ $ this ->gateway ->$ setter ($ value );
235
+
236
+ // request should have matching property, with correct value
237
+ $ request = $ this ->gateway ->purchase ();
238
+ $ this ->assertSame ($ value , $ request ->$ getter ());
239
+ }
240
+ }
241
+
242
+ public function testCompletePurchaseParameters ()
243
+ {
244
+ if ($ this ->gateway ->supportsCompletePurchase ()) {
245
+ foreach ($ this ->gateway ->getDefaultParameters () as $ key => $ default ) {
246
+ // set property on gateway
247
+ $ getter = 'get ' .ucfirst ($ key );
248
+ $ setter = 'set ' .ucfirst ($ key );
249
+ $ value = uniqid ();
250
+ $ this ->gateway ->$ setter ($ value );
251
+
252
+ // request should have matching property, with correct value
253
+ $ request = $ this ->gateway ->completePurchase ();
254
+ $ this ->assertSame ($ value , $ request ->$ getter ());
255
+ }
256
+ }
257
+ }
258
+
259
+ public function testRefundParameters ()
260
+ {
261
+ if ($ this ->gateway ->supportsRefund ()) {
262
+ foreach ($ this ->gateway ->getDefaultParameters () as $ key => $ default ) {
263
+ // set property on gateway
264
+ $ getter = 'get ' .ucfirst ($ key );
265
+ $ setter = 'set ' .ucfirst ($ key );
266
+ $ value = uniqid ();
267
+ $ this ->gateway ->$ setter ($ value );
268
+
269
+ // request should have matching property, with correct value
270
+ $ request = $ this ->gateway ->refund ();
271
+ $ this ->assertSame ($ value , $ request ->$ getter ());
272
+ }
273
+ }
274
+ }
275
+
276
+ public function testVoidParameters ()
277
+ {
278
+ if ($ this ->gateway ->supportsVoid ()) {
279
+ foreach ($ this ->gateway ->getDefaultParameters () as $ key => $ default ) {
280
+ // set property on gateway
281
+ $ getter = 'get ' .ucfirst ($ key );
282
+ $ setter = 'set ' .ucfirst ($ key );
283
+ $ value = uniqid ();
284
+ $ this ->gateway ->$ setter ($ value );
285
+
286
+ // request should have matching property, with correct value
287
+ $ request = $ this ->gateway ->void ();
288
+ $ this ->assertSame ($ value , $ request ->$ getter ());
289
+ }
290
+ }
291
+ }
292
+
293
+ public function testStoreParameters ()
294
+ {
295
+ if ($ this ->gateway ->supportsStore ()) {
296
+ foreach ($ this ->gateway ->getDefaultParameters () as $ key => $ default ) {
297
+ // set property on gateway
298
+ $ getter = 'get ' .ucfirst ($ key );
299
+ $ setter = 'set ' .ucfirst ($ key );
300
+ $ value = uniqid ();
301
+ $ this ->gateway ->$ setter ($ value );
302
+
303
+ // request should have matching property, with correct value
304
+ $ request = $ this ->gateway ->store ();
305
+ $ this ->assertSame ($ value , $ request ->$ getter ());
306
+ }
307
+ }
308
+ }
309
+
310
+ public function testUnstoreParameters ()
311
+ {
312
+ if ($ this ->gateway ->supportsUnstore ()) {
313
+ foreach ($ this ->gateway ->getDefaultParameters () as $ key => $ default ) {
314
+ // set property on gateway
315
+ $ getter = 'get ' .ucfirst ($ key );
316
+ $ setter = 'set ' .ucfirst ($ key );
317
+ $ value = uniqid ();
318
+ $ this ->gateway ->$ setter ($ value );
319
+
320
+ // request should have matching property, with correct value
321
+ $ request = $ this ->gateway ->unstore ();
322
+ $ this ->assertSame ($ value , $ request ->$ getter ());
323
+ }
324
+ }
325
+ }
175
326
}
0 commit comments