@@ -10,22 +10,22 @@ class ClientTest extends \PHPUnit_Framework_TestCase
1010 public function __construct ()
1111 {
1212 $ this ->client = $ this ->getMockBuilder ('Databox\Client ' )
13- ->setMethods (['rawPush ' ])
13+ ->setMethods (['rawPush ' , ' rawGet ' ])
1414 ->getMock ();
1515 }
1616
1717 public function testClientCorrectOptions ()
1818 {
19- $ mimeType = 'application/json ' ;
19+ $ mimeType = 'application/json ' ;
2020 $ userAgent = 'databox-php ' ;
21- $ token = 'test-token ' ;
22- $ baseUrl = 'https://push2new.databox.com ' ;
21+ $ token = 'test-token ' ;
22+ $ baseUrl = 'https://push2new.databox.com ' ;
2323
2424 $ client = new Client ($ token );
2525 $ this ->assertEquals ($ mimeType , $ client ->getConfig ('headers ' )['Content-Type ' ]);
2626 $ this ->assertEquals ($ userAgent , substr ($ client ->getConfig ('headers ' )['User-Agent ' ], 0 , 11 ));
2727 $ this ->assertEquals ($ mimeType , $ client ->getConfig ('headers ' )['Accept ' ]);
28- $ this ->assertEquals ($ baseUrl , (string ) $ client ->getConfig ('base_uri ' ));
28+ $ this ->assertEquals ($ baseUrl , (string )$ client ->getConfig ('base_uri ' ));
2929 $ this ->assertEquals ($ token , $ client ->getConfig ('auth ' )[0 ]);
3030 }
3131
@@ -35,16 +35,28 @@ public function testRawPush()
3535 ->setMethods (['post ' ])
3636 ->getMock ();
3737
38- $ json = '{"status":"ok"} ' ;
38+ $ json = '{"status":"ok"} ' ;
3939 $ response = new Response (200 , [], $ json );
4040 $ client ->method ('post ' )->willReturn ($ response );
4141
4242 $ this ->assertEquals ($ json , json_encode ($ client ->rawPush ()));
4343 }
4444
45+ public function testRawGet ()
46+ {
47+ $ client = $ this ->getMockBuilder ('Databox\Client ' )
48+ ->setMethods (['get ' ])
49+ ->getMock ();
50+
51+ $ json = '[] ' ;
52+ $ response = new Response (200 , [], $ json );
53+ $ client ->method ('get ' )->willReturn ($ response );
54+ $ this ->assertEquals ($ json , json_encode ([]));
55+ }
56+
4557 public function testLastPush ()
4658 {
47- $ this ->client ->method ('rawPush ' )->willReturn ([
59+ $ this ->client ->method ('rawGet ' )->willReturn ([
4860 [], []
4961 ]);
5062
0 commit comments