/** * @expectedException \Widop\Twitter\OAuth\OAuthException * @expectedExceptionMessage An error occured when invalidating the bearer token. */ public function testInvalidateBearerTokenWithInvalidResponse() { $bearerToken = $this->getMockBuilder('Widop\\Twitter\\OAuth\\Token\\BearerToken')->disableOriginalConstructor()->getMock(); $bearerToken->expects($this->any())->method('getValue')->will($this->returnValue('token')); $response = $this->getMockBuilder('Widop\\HttpAdapter\\HttpResponse')->disableOriginalConstructor()->getMock(); $response->expects($this->once())->method('getBody')->will($this->returnValue('{"foo":"bar"}')); $this->httpAdapter->expects($this->once())->method('postContent')->with($this->equalTo('https://api.twitter.com/oauth2/invalidate_token'), $this->equalTo(array('Authorization' => 'Basic Y29uc3VtZXJfa2V5OmNvbnN1bWVyX3NlY3JldA==')), $this->equalTo(array('access_token' => 'token')))->will($this->returnValue($response)); $this->oauth->invalidateBearerToken($bearerToken); }