'ERROR_CODE_1', 'error_messages' => [ 'Oh dear...', 'Oh no...' ], 'correlation_id' => 'corr_id_1' ]; $request = $this->getMockBuilder('GuzzleHttp\Message\RequestInterface') ->getMock(); $response = $this->getMockBuilder('GuzzleHttp\Message\ResponseInterface') ->getMock(); $response->expects($this->once()) ->method('getStatusCode') ->will($this->returnValue('500')); $previous = new RequestException('Error', $request, $response); $exception = new ConnectorException($data, $previous); $this->assertEquals(500, $exception->getCode()); $this->assertSame($response, $exception->getResponse()); $this->assertContains( $data['error_messages'][0], $exception->getMessages() ); $this->assertContains( $data['error_messages'][1], $exception->getMessages() ); $this->assertEquals($data['error_code'], $exception->getErrorCode()); $this->assertEquals($data['correlation_id'], $exception->getCorrelationId()); $this->assertSame($previous, $exception->getPrevious()); $this->assertEquals( 'ERROR_CODE_1: Oh dear..., Oh no... (#corr_id_1)', $exception->getMessage() ); } }