@@ -304,4 +304,80 @@ public function testParseAccessTokenResponseValid()
304
304
305
305
$ this ->assertInstanceOf ('\\OAuth \\OAuth1 \\Token \\StdOAuth1Token ' , $ service ->requestAccessToken ('foo ' , 'bar ' , $ token ));
306
306
}
307
+
308
+ /**
309
+ * @covers OAuth\OAuth1\Service\Twitter::parseAccessTokenResponse
310
+ */
311
+ public function testParseAccessTokenErrorTotalBullshit ()
312
+ {
313
+ $ client = $ this ->getMock ('\\OAuth \\Common \\Http \\Client \\ClientInterface ' );
314
+ $ service = new Twitter (
315
+ $ this ->getMock ('\\OAuth \\Common \\Consumer \\CredentialsInterface ' ),
316
+ $ client ,
317
+ $ this ->getMock ('\\OAuth \\Common \\Storage \\TokenStorageInterface ' ),
318
+ $ this ->getMock ('\\OAuth \\OAuth1 \\Signature \\SignatureInterface ' )
319
+ );
320
+
321
+ $ this ->setExpectedException ('\\OAuth \\Common \\Http \\Exception \\TokenResponseException ' );
322
+ $ method = new \ReflectionMethod (get_class ($ service ), 'parseAccessTokenResponse ' );
323
+ $ method ->setAccessible (true );
324
+ $ method ->invokeArgs ($ service , array ("hoho " ));
325
+ }
326
+
327
+ /**
328
+ * @covers OAuth\OAuth1\Service\Twitter::parseAccessTokenResponse
329
+ */
330
+ public function testParseAccessTokenErrorItsAnError ()
331
+ {
332
+ $ client = $ this ->getMock ('\\OAuth \\Common \\Http \\Client \\ClientInterface ' );
333
+ $ service = new Twitter (
334
+ $ this ->getMock ('\\OAuth \\Common \\Consumer \\CredentialsInterface ' ),
335
+ $ client ,
336
+ $ this ->getMock ('\\OAuth \\Common \\Storage \\TokenStorageInterface ' ),
337
+ $ this ->getMock ('\\OAuth \\OAuth1 \\Signature \\SignatureInterface ' )
338
+ );
339
+
340
+ $ this ->setExpectedException ('\\OAuth \\Common \\Http \\Exception \\TokenResponseException ' );
341
+ $ method = new \ReflectionMethod (get_class ($ service ), 'parseAccessTokenResponse ' );
342
+ $ method ->setAccessible (true );
343
+ $ method ->invokeArgs ($ service , array ("error=hihihaha " ));
344
+ }
345
+
346
+ /**
347
+ * @covers OAuth\OAuth1\Service\Twitter::parseAccessTokenResponse
348
+ */
349
+ public function testParseAccessTokenErrorItsMissingOauthToken ()
350
+ {
351
+ $ client = $ this ->getMock ('\\OAuth \\Common \\Http \\Client \\ClientInterface ' );
352
+ $ service = new Twitter (
353
+ $ this ->getMock ('\\OAuth \\Common \\Consumer \\CredentialsInterface ' ),
354
+ $ client ,
355
+ $ this ->getMock ('\\OAuth \\Common \\Storage \\TokenStorageInterface ' ),
356
+ $ this ->getMock ('\\OAuth \\OAuth1 \\Signature \\SignatureInterface ' )
357
+ );
358
+
359
+ $ this ->setExpectedException ('\\OAuth \\Common \\Http \\Exception \\TokenResponseException ' );
360
+ $ method = new \ReflectionMethod (get_class ($ service ), 'parseAccessTokenResponse ' );
361
+ $ method ->setAccessible (true );
362
+ $ method ->invokeArgs ($ service , array ("oauth_token_secret=1 " ));
363
+ }
364
+
365
+ /**
366
+ * @covers OAuth\OAuth1\Service\Twitter::parseAccessTokenResponse
367
+ */
368
+ public function testParseAccessTokenErrorItsMissingOauthTokenSecret ()
369
+ {
370
+ $ client = $ this ->getMock ('\\OAuth \\Common \\Http \\Client \\ClientInterface ' );
371
+ $ service = new Twitter (
372
+ $ this ->getMock ('\\OAuth \\Common \\Consumer \\CredentialsInterface ' ),
373
+ $ client ,
374
+ $ this ->getMock ('\\OAuth \\Common \\Storage \\TokenStorageInterface ' ),
375
+ $ this ->getMock ('\\OAuth \\OAuth1 \\Signature \\SignatureInterface ' )
376
+ );
377
+
378
+ $ this ->setExpectedException ('\\OAuth \\Common \\Http \\Exception \\TokenResponseException ' );
379
+ $ method = new \ReflectionMethod (get_class ($ service ), 'parseAccessTokenResponse ' );
380
+ $ method ->setAccessible (true );
381
+ $ method ->invokeArgs ($ service , array ("oauth_token=1 " ));
382
+ }
307
383
}
0 commit comments