File tree 3 files changed +27
-1
lines changed
src/Omnipay/Common/Message
tests/Omnipay/Common/Message
3 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -321,6 +321,13 @@ public function setNotifyUrl($value)
321
321
return $ this ->setParameter ('notifyUrl ' , $ value );
322
322
}
323
323
324
+ public function send ()
325
+ {
326
+ $ data = $ this ->getData ();
327
+
328
+ return $ this ->sendData ($ data );
329
+ }
330
+
324
331
public function getResponse ()
325
332
{
326
333
if (null === $ this ->response ) {
Original file line number Diff line number Diff line change @@ -32,4 +32,12 @@ public function getResponse();
32
32
* @return ResponseInterface
33
33
*/
34
34
public function send ();
35
+
36
+ /**
37
+ * Send the request with specified data
38
+ *
39
+ * @param mixed $data The data to send
40
+ * @return ResponseInterface
41
+ */
42
+ public function sendData ($ data );
35
43
}
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ class AbstractRequestTest extends TestCase
11
11
{
12
12
public function setUp ()
13
13
{
14
- $ this ->request = m::mock ('\Omnipay\Common\Message\AbstractRequest[getData,send ] ' );
14
+ $ this ->request = m::mock ('\Omnipay\Common\Message\AbstractRequest[getData,sendData ] ' );
15
15
$ this ->request ->initialize ();
16
16
}
17
17
@@ -261,6 +261,17 @@ public function testNoCurrencyReturnedIfCurrencyNotSet()
261
261
$ this ->assertNull ($ this ->request ->getCurrencyNumeric ());
262
262
}
263
263
264
+ public function testSend ()
265
+ {
266
+ $ response = m::mock ('\Omnipay\Common\Message\ResponseInterface ' );
267
+ $ data = array ('request data ' );
268
+
269
+ $ this ->request ->shouldReceive ('getData ' )->once ()->andReturn ($ data );
270
+ $ this ->request ->shouldReceive ('sendData ' )->once ()->with ($ data )->andReturn ($ response );
271
+
272
+ $ this ->assertSame ($ response , $ this ->request ->send ());
273
+ }
274
+
264
275
/**
265
276
* @expectedException \Omnipay\Common\Exception\RuntimeException
266
277
*/
You can’t perform that action at this time.
0 commit comments