File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed
Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ class Client
3232 public function __construct (ConnectionInterface $ connection , $ token = 'anonymous ' )
3333 {
3434 $ this ->connection = $ connection ;
35- $ this ->token = $ token ;
35+ $ this ->setToken ( $ token) ;
3636 }
3737
3838 /**
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ public function testConnection()
2626 }
2727
2828
29- /* TEST CALL FORMAT JSON
29+ /* TEST CALL
3030 *************************************************************************/
3131 /**
3232 * @dataProvider providerCall
@@ -63,6 +63,23 @@ public function providerCall()
6363 }
6464
6565
66+ /* TEST CALL EXCEPTION
67+ *************************************************************************/
68+ public function testCallException ()
69+ {
70+ $ connection = $ this ->getConnectionMock ();
71+ $ client = new Client ($ connection , '123 ' );
72+
73+ $ connection
74+ ->expects ($ this ->once ())
75+ ->method ('send ' )
76+ ->will ($ this ->returnValue (serialize (array ('result ' =>'error ' , 'message ' =>'test ' ))));
77+
78+ $ this ->setExpectedException ('Knp\PiwikClient\Exception\Exception ' );
79+ $ client ->call ('API.getReportMetadata ' );
80+ }
81+
82+
6683 /* UTILS
6784 *************************************************************************/
6885 protected function getConnectionMock ()
You can’t perform that action at this time.
0 commit comments