expectException(ResponseParserException::class); $this->expectExceptionMessage('empty response (0 bytes)'); (new ApiResponseParser())->parseXmlString(ApiClient::TYPE_NOTIFICATION, ''); } public function testTruncatedResponseNamesTheLibxmlReason(): void { $xml = 'parseXmlString(ApiClient::TYPE_NOTIFICATION, $xml); $this->fail('Expected a ResponseParserException'); } catch (ResponseParserException $e) { self::assertStringContainsString('('.strlen($xml).' bytes)', $e->getMessage()); self::assertStringContainsString('line 1', $e->getMessage()); } } public function testWellFormedResponseOfAnUnknownType(): void { $xml = ''; $this->expectException(ResponseParserException::class); $this->expectExceptionMessage('Unrecognised BusProNet response type "IRGENDWAS"'); (new ApiResponseParser())->parseXmlString(ApiClient::TYPE_NOTIFICATION, $xml); } public function testUnknownCustomerDataSubtype(): void { $xml = 'Irgendwas'; $this->expectException(ResponseParserException::class); $this->expectExceptionMessage('Unrecognised customer data subtype "Irgendwas"'); (new ApiResponseParser())->parseXmlString(ApiClient::TYPE_CUSTOMER_DATA, $xml); } public function testDiagnosingDoesNotLeakLibxmlErrorState(): void { $previous = libxml_use_internal_errors(false); try { try { (new ApiResponseParser())->parseXmlString(ApiClient::TYPE_NOTIFICATION, '