File tree Expand file tree Collapse file tree 2 files changed +62
-0
lines changed Expand file tree Collapse file tree 2 files changed +62
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,13 @@ public function setUp()
24
24
);
25
25
}
26
26
27
+ public function testFindCustomer ()
28
+ {
29
+ $ request = $ this ->gateway ->findCustomer (1 );
30
+ $ this ->assertInstanceOf ('\Omnipay\Braintree\Message\FindCustomerRequest ' , $ request );
31
+ $ this ->assertEquals (1 , $ request ->getCustomerId ());
32
+ }
33
+
27
34
public function testAuthorize ()
28
35
{
29
36
$ request = $ this ->gateway ->authorize (array ('amount ' => '10.00 ' ));
Original file line number Diff line number Diff line change
1
+ <?php
2
+ namespace Omnipay \Braintree \Message ;
3
+
4
+ use Omnipay \Tests \TestCase ;
5
+
6
+ class FindCustomerRequestTest extends TestCase
7
+ {
8
+ /**
9
+ * @var CreateCustomerRequest
10
+ */
11
+ private $ request ;
12
+
13
+ public function setUp ()
14
+ {
15
+ parent ::setUp ();
16
+
17
+ $ gateway = $ this ->buildMockGateway ();
18
+ $ this ->request = new FindCustomerRequest ($ this ->getHttpClient (), $ this ->getHttpRequest (), $ gateway );
19
+ $ this ->request ->initialize (array ('customerId ' => 1 ));
20
+ }
21
+
22
+ public function testGetData ()
23
+ {
24
+ $ data = $ this ->request ->getData ();
25
+ $ this ->assertNull ($ data );
26
+ }
27
+
28
+ public function testSendData ()
29
+ {
30
+ $ data = array ();
31
+ $ response = $ this ->request ->sendData ($ data );
32
+
33
+ $ this ->assertInstanceOf ('Omnipay\Braintree\Message\CustomerResponse ' , $ response );
34
+ }
35
+
36
+ protected function buildMockGateway ()
37
+ {
38
+ $ gateway = $ this ->getMockBuilder ('\Braintree_Gateway ' )
39
+ ->disableOriginalConstructor ()
40
+ ->setMethods (array (
41
+ 'customer '
42
+ ))
43
+ ->getMock ();
44
+
45
+ $ customer = $ this ->getMockBuilder ('\Braintree_CustomerGateway ' )
46
+ ->disableOriginalConstructor ()
47
+ ->getMock ();
48
+
49
+ $ gateway ->expects ($ this ->any ())
50
+ ->method ('customer ' )
51
+ ->will ($ this ->returnValue ($ customer ));
52
+
53
+ return $ gateway ;
54
+ }
55
+ }
You can’t perform that action at this time.
0 commit comments