feat: map house manager roles and houses by crm ids instead of labels
This commit is contained in:
@@ -86,6 +86,25 @@ class ResponseParserTest extends TestCase
|
||||
$this->assertCount(3, $response->getAttributeGroups());
|
||||
}
|
||||
|
||||
/**
|
||||
* The house of a "Hausleitung" selection comes from the configured id map, never from the
|
||||
* label: an id that is not mapped grants nothing. That is also what keeps the houses
|
||||
* commented out in bpn_crm_house_manager_ids from letting someone in who would then see
|
||||
* no assignments and no dispositions at all.
|
||||
*/
|
||||
public function testParseCrmAttributesIgnoresAnUnmappedHouseManagerSelection(): void
|
||||
{
|
||||
$content = '<?xml version="1.0" encoding="utf-8"?><ergebnis><satz typ="KUNDENKONTO"></satz><art>SelektionCRM</art><idadresse>141747</idadresse><idperson>224526</idperson><selektionsmerkmale><selektionsgruppe id="10" bezeichnung="TEAM"><selektion id="1070" bezeichnung="E&P Teamer - allg. Merkmal" aenderbar="False" auswahl="True"></selektion><selektion id="9999" bezeichnung="Hausleitung XYZ" aenderbar="False" auswahl="True"></selektion></selektionsgruppe></selektionsmerkmale></ergebnis>';
|
||||
|
||||
$parser = $this->getParserInstance();
|
||||
$response = $parser->parseXmlString(ApiClient::TYPE_CUSTOMER_DATA, $content);
|
||||
|
||||
$this->assertInstanceOf(CrmAttributesResponse::class, $response);
|
||||
$this->assertTrue($response->isTeamer());
|
||||
$this->assertFalse($response->isHouseManager());
|
||||
$this->assertSame([], $response->getHotelCodes());
|
||||
}
|
||||
|
||||
public function testParseCrmAttributesOfAnEmptyResponse(): void
|
||||
{
|
||||
$content = '<?xml version="1.0" encoding="utf-8"?><ergebnis><satz typ="KUNDENKONTO"></satz><art>SelektionCRM</art><idadresse>141747</idadresse><idperson>224526</idperson><selektionsmerkmale></selektionsmerkmale></ergebnis>';
|
||||
@@ -170,6 +189,14 @@ class ResponseParserTest extends TestCase
|
||||
'bpn_crm_id_admin' => 1292,
|
||||
'bpn_crm_id_manager' => 1293,
|
||||
'bpn_crm_id_teamer' => 1070,
|
||||
// Deliberately a small excerpt of the configured map: the fixtures only carry
|
||||
// these three houses, and 1301 is here to be a mapped id no fixture selects.
|
||||
'bpn_crm_house_manager_ids' => [
|
||||
1299 => 'SSL',
|
||||
1301 => 'MVK',
|
||||
1304 => 'DKS',
|
||||
1305 => 'DGS',
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user