12
12
namespace Unicodeveloper \Jusibe \Test ;
13
13
14
14
use StdClass ;
15
+ use ReflectionClass ;
15
16
use PHPUnit_Framework_TestCase ;
16
17
use Unicodeveloper \Jusibe \Helper ;
17
18
use Unicodeveloper \Jusibe \Jusibe ;
@@ -255,4 +256,37 @@ public function testInvalidMessageIDWhenCheckingDeliveryStatus()
255
256
$ this ->assertObjectHasAttribute ('invalid_message_id ' , $ result );
256
257
$ this ->assertEquals ("Invalid message ID " , $ result ->invalid_message_id );
257
258
}
259
+
260
+ /**
261
+ * Invoke testPrepareRequest
262
+ */
263
+ public function testPrepareRequest ()
264
+ {
265
+ $ this ->invokeMethod ($ this ->jusibe , 'prepareRequest ' , []);
266
+ }
267
+
268
+ /**
269
+ * Invoke testPerformGetRequest
270
+ */
271
+ public function testPerformGetRequest ()
272
+ {
273
+ $ this ->invokeMethod ($ this ->jusibe , 'performGetRequest ' , ['/smsapi/get_credits ' ]);
274
+ }
275
+
276
+ /**
277
+ * Call protected/private method of a class.
278
+ *
279
+ * @param object &$object Instantiated object that we will run method on.
280
+ * @param string $methodName Method name to call
281
+ * @param array $parameters Array of parameters to pass into method.
282
+ *
283
+ * @return mixed Method return.
284
+ */
285
+ private function invokeMethod (&$ object , $ methodName , array $ parameters = array ())
286
+ {
287
+ $ reflection = new ReflectionClass (get_class ($ object ));
288
+ $ method = $ reflection ->getMethod ($ methodName );
289
+ $ method ->setAccessible (true );
290
+ return $ method ->invokeArgs ($ object , $ parameters );
291
+ }
258
292
}
0 commit comments