853ID, EMail oder Passwort falsch'; $parser = $this->getParserInstance(); $response = $parser->parseXmlString($content); $this->assertEquals(853, $response->getCode()); $this->assertEquals('ID, EMail oder Passwort falsch', $response->getMessage()); $this->assertFalse($response->isSuccessful()); } public function testParseSuccessfulProfileResponse(): void { $content = 'Adressdaten141747224526FrommeBjörnHerrM16.04.1972D119447Emilienstraße 5742853RemscheidDmail@fromme.orgFalse02191-4615837'; $parser = $this->getParserInstance(); $response = $parser->parseXmlString($content); $this->assertInstanceOf(ProfileResponse::class, $response); $this->assertNull($response->getCode()); $this->assertNull($response->getMessage()); $this->assertTrue($response->isSuccessful()); } public function testParseSuccessfulCrmAttributesResponse(): void { $content = 'SelektionCRM141747224526'; $parser = $this->getParserInstance(); $response = $parser->parseXmlString($content); $this->assertInstanceOf(CrmAttributesResponse::class, $response); $this->assertNull($response->getCode()); $this->assertNull($response->getMessage()); $this->assertTrue($response->isSuccessful()); $this->assertCount(3, $response->getAttributeGroups()); $this->assertTrue($response->isTeamer()); } public function testParseSuccessfulPickupsResponse(): void { $content = 'KarlsruheA5 - Autohof BruchsalBUSFalseTrueTrueBonnBahnhofBUS FalseTrueTrue'; $parser = $this->getParserInstance(); $response = $parser->parseXmlString($content); $this->assertInstanceOf(PickupsResponse::class, $response); $pickups = $response->getPickups(); $this->assertCount(2, $pickups); $pickup = reset($pickups); $this->assertInstanceOf(Pickup::class, $pickup); $this->assertEquals(1, $pickup->getId()); $this->assertEquals(1, $pickup->getBusProId()); $this->assertEquals('298', $pickup->getCode()); $this->assertEquals('Karlsruhe', $pickup->getCity()); $this->assertEquals('A5 - Autohof Bruchsal', $pickup->getStreet()); } private function getParserInstance(): ResponseParser { return new ResponseParser([ 'bpn_crm_id_admin' => 1292, 'bpn_crm_id_manager' => 1293, 'bpn_crm_id_teamer' => 1070, ]); } }