/** * @test * @expectedException PHPSC\PagSeguro\Client\PagSeguroException */ public function handleErrorShouldRaiseExceptionWhenHostIsFromPagSeguro() { $client = new Client($this->httpClient); $event = new Event(['request' => $this->request, 'response' => $this->response]); $this->request->expects($this->any())->method('getHost')->willReturn(Production::WS_HOST); $this->response->expects($this->any())->method('getStatusCode')->willReturn(401); $this->response->expects($this->any())->method('getBody')->willReturn('Unauthorized'); $client->handleError($event); }