@@ -30,11 +30,11 @@ public function testRevokeAccess()
3030 $ token = '' ;
3131
3232 $ response = $ this ->getMock ('Psr\Http\Message\ResponseInterface ' );
33- $ response ->expects ($ this ->exactly (2 ))
33+ $ response ->expects ($ this ->exactly (3 ))
3434 ->method ('getStatusCode ' )
3535 ->will ($ this ->returnValue (200 ));
3636 $ http = $ this ->getMock ('GuzzleHttp\ClientInterface ' );
37- $ http ->expects ($ this ->exactly (2 ))
37+ $ http ->expects ($ this ->exactly (3 ))
3838 ->method ('send ' )
3939 ->will ($ this ->returnCallback (
4040 function ($ request ) use (&$ token , $ response ) {
@@ -49,13 +49,13 @@ function ($request) use (&$token, $response) {
4949 if ($ this ->isGuzzle5 ()) {
5050 $ requestToken = null ;
5151 $ request = $ this ->getMock ('GuzzleHttp\Message\RequestInterface ' );
52- $ request ->expects ($ this ->exactly (2 ))
52+ $ request ->expects ($ this ->exactly (3 ))
5353 ->method ('getBody ' )
5454 ->will ($ this ->returnCallback (
5555 function () use (&$ requestToken ) {
5656 return 'token= ' .$ requestToken ;
5757 }));
58- $ http ->expects ($ this ->exactly (2 ))
58+ $ http ->expects ($ this ->exactly (3 ))
5959 ->method ('createRequest ' )
6060 ->will ($ this ->returnCallback (
6161 function ($ method , $ url , $ params ) use (&$ requestToken , $ request ) {
@@ -88,19 +88,11 @@ function ($method, $url, $params) use (&$requestToken, $request) {
8888 );
8989 $ this ->assertTrue ($ revoke ->revokeToken ($ t ));
9090 $ this ->assertEquals ($ refreshToken , $ token );
91- }
9291
93- public function testInvalidStringToken ()
94- {
95- $ phpVersion = phpversion ();
96- if ('7 ' === $ phpVersion [0 ]) {
97- // primitive type hints actually throw exceptions in PHP7
98- $ this ->setExpectedException ('TypeError ' );
99- } else {
100- $ this ->setExpectedException ('PHPUnit_Framework_Error ' );
101- }
102- // Test with string token
103- $ revoke = new Google_AccessToken_Revoke ();
104- $ revoke ->revokeToken ('ACCESS_TOKEN ' );
92+ // Test with token string.
93+ $ revoke = new Google_AccessToken_Revoke ($ http );
94+ $ t = $ accessToken ;
95+ $ this ->assertTrue ($ revoke ->revokeToken ($ t ));
96+ $ this ->assertEquals ($ accessToken , $ token );
10597 }
10698}
0 commit comments