/** * @test * @expectedException \PHPSC\PagSeguro\Client\PagSeguroException */ public function handleErrorShouldRaiseExceptionWhenHostIsFromPagSeguro() { $client = new Client($this->httpClient); $transaction = new Transaction($this->httpClient, $this->request); $transaction->response = $this->response; $event = new Event($transaction); $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); }