File tree Expand file tree Collapse file tree 3 files changed +27
-1
lines changed
src/Omnipay/Common/Message
tests/Omnipay/Common/Message Expand file tree Collapse file tree 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)
321321 return $ this ->setParameter ('notifyUrl ' , $ value );
322322 }
323323
324+ public function send ()
325+ {
326+ $ data = $ this ->getData ();
327+
328+ return $ this ->sendData ($ data );
329+ }
330+
324331 public function getResponse ()
325332 {
326333 if (null === $ this ->response ) {
Original file line number Diff line number Diff line change @@ -32,4 +32,12 @@ public function getResponse();
3232 * @return ResponseInterface
3333 */
3434 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 );
3543}
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ class AbstractRequestTest extends TestCase
1111{
1212 public function setUp ()
1313 {
14- $ this ->request = m::mock ('\Omnipay\Common\Message\AbstractRequest[getData,send ] ' );
14+ $ this ->request = m::mock ('\Omnipay\Common\Message\AbstractRequest[getData,sendData ] ' );
1515 $ this ->request ->initialize ();
1616 }
1717
@@ -261,6 +261,17 @@ public function testNoCurrencyReturnedIfCurrencyNotSet()
261261 $ this ->assertNull ($ this ->request ->getCurrencyNumeric ());
262262 }
263263
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+
264275 /**
265276 * @expectedException \Omnipay\Common\Exception\RuntimeException
266277 */
You can’t perform that action at this time.
0 commit comments