/** * Test the response in case of a success api response */ public function testErrorCreation() { $fakeData = <<<EOF <?xml version="1.0" encoding="UTF-8"?> <response> <status>ERROR</status> <errormessage>Kontakt existiert nicht.</errormessage> </response> EOF; /** @var IsSubscriberOnListResponse $response */ $response = $this->response->create($this->converter->reconvert($fakeData)); $this->assertFalse($response->isSuccess()); $this->assertFalse($response->userExists()); $this->assertEquals('Kontakt existiert nicht.', $response->getErrorMessage()); }
/** * Test the response in case of a error api response */ public function testErrorCreation() { $fakeData = <<<EOF <?xml version="1.0" encoding="UTF-8"?> <response> <status>ERROR</status> <errormessage>NICHT AUF DER LISTE!</errormessage> </response> EOF; /** @var GetSubscribersResponse $response */ $response = $this->response->create($this->converter->reconvert($fakeData)); $this->assertFalse($response->isSuccess()); $this->assertNotEmpty($response->getErrorMessage()); $this->assertEquals('NICHT AUF DER LISTE!', $response->getErrorMessage()); $this->assertCount(0, $response->getData()); }
/** * Test the response in case of a error api response */ public function testCreationWithInvalidData() { $fakeData = <<<EOF <responseee> <status>NOT A VALID XML STRING</status> </responseee> EOF; /** @var BaseResponse $response */ $this->assertFalse($this->response->create($this->converter->reconvert($fakeData))); }