@@ -37,9 +37,9 @@ public function __construct($name = null, array $data = array(), $dataName = '')
3737
3838 private function setTestConfig ()
3939 {
40- \ Cloudipsp \ Configuration::setMerchantId ($ this ->mid );
41- \ Cloudipsp \ Configuration::setSecretKey ($ this ->secret_key );
42- \ Cloudipsp \ Configuration::setApiVersion ('1.0 ' );
40+ Configuration::setMerchantId ($ this ->mid );
41+ Configuration::setSecretKey ($ this ->secret_key );
42+ Configuration::setApiVersion ('1.0 ' );
4343 }
4444
4545 /**
@@ -48,7 +48,7 @@ private function setTestConfig()
4848 public function testStatus ()
4949 {
5050 $ this ->setTestConfig ();
51- $ data = \ Cloudipsp \ Order::status ($ this ->orderID );
51+ $ data = Order::status ($ this ->orderID );
5252 $ result = $ data ->getData ();
5353 $ this ->assertNotEmpty ($ result ['order_id ' ], 'order_id is empty ' );
5454 $ this ->assertNotEmpty ($ result ['order_status ' ], 'order_status is empty ' );
@@ -67,9 +67,9 @@ public function testCapture()
6767 'amount ' => 1000 ,
6868 'order_id ' => $ this ->orderID ['order_id ' ]
6969 ];
70- $ data = \ Cloudipsp \ Order::capture ($ captureData );
70+ $ data = Order::capture ($ captureData );
7171 $ result = $ data ->getData ();
72- $ this ->assertInternalType ( ' array ' , $ result );
72+ $ this ->assertIsMyArray ( $ result );
7373 $ this ->assertEquals ($ result ['capture_status ' ], 'captured ' );
7474 }
7575
@@ -84,7 +84,7 @@ public function testReverse()
8484 'amount ' => 1000 ,
8585 'order_id ' => $ this ->orderID ['order_id ' ]
8686 ];
87- $ data = \ Cloudipsp \ Order::reverse ($ reverseData );
87+ $ data = Order::reverse ($ reverseData );
8888 $ result = $ data ->getData ();
8989 $ this ->assertNotEmpty ($ result ['order_id ' ], 'order_id is empty ' );
9090 $ this ->assertEquals ($ result ['response_status ' ], 'success ' );
@@ -97,23 +97,25 @@ public function testReverse()
9797 public function testTransactionList ()
9898 {
9999 $ this ->setTestConfig ();
100- $ data = \ Cloudipsp \ Order::transactionList ($ this ->orderID );
100+ $ data = Order::transactionList ($ this ->orderID );
101101 $ result = $ data ->getData ();
102- $ this ->assertInternalType ( ' array ' , $ result );
103- $ this ->assertContains ( ' payment_id ' , $ result [0 ]);
102+ $ this ->assertIsMyArray ( $ result );
103+ $ this ->assertEquals ( ' approved ' , $ result [0 ][ ' transaction_status ' ]);
104104
105105 }
106106
107107 /**
108- * @throws Exception\ApiException
108+ * @param $array
109+ * @param $message
109110 */
110- /*public function testAtolLogs( )
111+ private function assertIsMyArray ( $ array , $ message = '' )
111112 {
112- $this->setTestConfig();
113- $data = \Cloudipsp\Order::atolLogs($this->orderID);
114- $result = $data->getData();
115- $this->assertInternalType('array', $result);
116- }*/
113+ if (method_exists (get_parent_class ($ this ), 'assertIsArray ' )) {
114+ $ this ->assertIsArray ($ array , $ message );
115+ } else {
116+ $ this ->assertInternalType ('array ' , $ array , $ message );
117+ }
118+ }
117119
118120 /**
119121 * @param $data
@@ -122,7 +124,7 @@ public function testTransactionList()
122124 */
123125 private function createOrder ($ data )
124126 {
125- $ data = \ Cloudipsp \ Pcidss::start ($ data );
127+ $ data = Pcidss::start ($ data );
126128 return $ data ->getData ()['order_id ' ];
127129 }
128130}
0 commit comments