@@ -21,14 +21,14 @@ public function setUp()
2121
2222 public function testCreate ()
2323 {
24- $ merchant_id = $ this ->merchant_id ;
24+ $ merchant_id = $ this ->merchant_id ;
2525 $ transaction_id = $ this ->transaction_id ;
2626
2727 $ new_transaction_id = $ this ->transactions ->create ($ merchant_id , array (
2828 'transactionId ' => $ transaction_id ,
29- 'currency ' => 'EUR ' ,
30- 'amount ' => 200 ,
31- 'custom ' => array (
29+ 'currency ' => 'EUR ' ,
30+ 'amount ' => 200 ,
31+ 'custom ' => array (
3232 'source ' => 'php client test '
3333 )
3434 ));
@@ -58,7 +58,7 @@ public function testCapture()
5858
5959 $ transaction = $ this ->transactions ->capture ($ new_transaction_id , array (
6060 'currency ' => 'EUR ' ,
61- 'amount ' => 100
61+ 'amount ' => 100
6262 ));
6363
6464 $ this ->assertEquals ($ transaction ['capturedAmount ' ], 100 ,
@@ -79,7 +79,7 @@ public function testCaptureBiggerAmount()
7979 $ new_transaction_id = $ this ->createNewTransactionForTest ();
8080 $ this ->transactions ->capture ($ new_transaction_id , array (
8181 'currency ' => 'EUR ' ,
82- 'amount ' => 400
82+ 'amount ' => 400
8383 ));
8484 }
8585
@@ -89,7 +89,7 @@ public function testRefund()
8989
9090 $ this ->transactions ->capture ($ new_transaction_id , array (
9191 'currency ' => 'EUR ' ,
92- 'amount ' => 200
92+ 'amount ' => 200
9393 ));
9494
9595 $ transaction = $ this ->transactions ->refund ($ new_transaction_id , array (
@@ -134,18 +134,41 @@ public function testVoid()
134134 */
135135 private function createNewTransactionForTest ()
136136 {
137- $ merchant_id = $ this ->merchant_id ;
137+ $ merchant_id = $ this ->merchant_id ;
138138 $ transaction_id = $ this ->transaction_id ;
139139
140140 $ new_transaction_id = $ this ->transactions ->create ($ merchant_id , array (
141141 'transactionId ' => $ transaction_id ,
142- 'currency ' => 'EUR ' ,
143- 'amount ' => 300 ,
144- 'custom ' => array (
142+ 'currency ' => 'EUR ' ,
143+ 'amount ' => 300 ,
144+ 'custom ' => array (
145145 'source ' => 'php client test '
146146 )
147147 ));
148148
149149 return $ new_transaction_id ;
150150 }
151+
152+ /**
153+ *
154+ */
155+ public function testGetAllTransactions ()
156+ {
157+ $ merchant_id = $ this ->merchant_id ;
158+ $ transactions = array ();
159+ $ limit = 10 ;
160+ $ before = null ;
161+
162+ do {
163+ $ api_transactions = $ this ->transactions ->get ($ merchant_id , $ limit , $ before );
164+ if (count ($ api_transactions ) < $ limit ) {
165+ $ before = null ;
166+ } else {
167+ $ before = $ api_transactions [$ limit - 1 ]['id ' ];
168+ }
169+ $ transactions = array_merge ($ transactions , $ api_transactions );
170+ } while ($ before );
171+
172+ $ this ->assertGreaterThan (0 , count ($ transactions ), 'number of transactions ' );
173+ }
151174}
0 commit comments