33namespace Databox \Tests ;
44
55use Databox \Client ;
6- use GuzzleHttp \Message \Response ;
7- use GuzzleHttp \Stream \Stream ;
6+ use GuzzleHttp \Psr7 \Response ;
87
98class ClientTest extends \PHPUnit_Framework_TestCase
109{
@@ -17,14 +16,17 @@ public function __construct()
1716
1817 public function testClientCorrectOptions ()
1918 {
20- $ contentType = 'application/json ' ;
21- $ token = 'test-token ' ;
22- $ baseUrl = 'https://push2new.databox.com ' ;
19+ $ mimeType = 'application/json ' ;
20+ $ userAgent = 'databox-php ' ;
21+ $ token = 'test-token ' ;
22+ $ baseUrl = 'https://push2new.databox.com ' ;
2323
2424 $ client = new Client ($ token );
25- $ this ->assertEquals ($ contentType , $ client ->getDefaultOption ('headers/Content-Type ' ));
26- $ this ->assertEquals ($ token , $ client ->getDefaultOption ('auth/0 ' ));
27- $ this ->assertEquals ($ baseUrl , $ client ->getBaseUrl ());
25+ $ this ->assertEquals ($ mimeType , $ client ->getConfig ('headers ' )['Content-Type ' ]);
26+ $ this ->assertEquals ($ userAgent , substr ($ client ->getConfig ('headers ' )['User-Agent ' ], 0 , 11 ));
27+ $ this ->assertEquals ($ mimeType , $ client ->getConfig ('headers ' )['Accept ' ]);
28+ $ this ->assertEquals ($ baseUrl , (string ) $ client ->getConfig ('base_uri ' ));
29+ $ this ->assertEquals ($ token , $ client ->getConfig ('auth ' )[0 ]);
2830 }
2931
3032 public function testRawPush ()
@@ -34,7 +36,7 @@ public function testRawPush()
3436 ->getMock ();
3537
3638 $ json = '{"status":"ok"} ' ;
37- $ response = new Response (200 , [], Stream:: factory ( $ json) );
39+ $ response = new Response (200 , [], $ json );
3840 $ client ->method ('post ' )->willReturn ($ response );
3941
4042 $ this ->assertEquals ($ json , json_encode ($ client ->rawPush ()));
0 commit comments