fix: retain original date of birth when anonymizing xml dumps

This commit is contained in:
Björn Fromme
2026-07-16 15:53:33 +02:00
parent bd2d8b58a3
commit fafc60eba9
2 changed files with 11 additions and 10 deletions
+11 -2
View File
@@ -17,6 +17,7 @@ class BpnXmlAnonymizerTest extends TestCase
<anmelder>
<name>Example</name>
<vorname>Ava</vorname>
<geburtsdatum>03.04.1991</geburtsdatum>
<anschrift>
<strasse>Testallee 7</strasse>
<plz>10115</plz>
@@ -32,6 +33,7 @@ class BpnXmlAnonymizerTest extends TestCase
<teilnehmer id="1">
<name>Example</name>
<vorname>Ava</vorname>
<geburtsdatum>03.04.1991</geburtsdatum>
<anschrift>
<strasse>Testallee 7</strasse>
<plz>10115</plz>
@@ -46,6 +48,7 @@ class BpnXmlAnonymizerTest extends TestCase
<teilnehmer id="2">
<name>Second</name>
<vorname>Ben</vorname>
<geburtsdatum>12.11.1987</geburtsdatum>
<kommunikation>
<email>[email protected]</email>
</kommunikation>
@@ -69,6 +72,9 @@ XML;
$applicantMobilePhone = trim((string) $xpath->evaluate('string(//anmelder/kommunikation/telefonmobil)'));
$participantOneMobilePhone = trim((string) $xpath->evaluate('string(//teilnehmer[1]/kommunikation/telefonmobil)'));
$participantTwoName = trim((string) $xpath->evaluate('string(//teilnehmer[2]/name)'));
$applicantBirthDate = trim((string) $xpath->evaluate('string(//anmelder/geburtsdatum)'));
$participantOneBirthDate = trim((string) $xpath->evaluate('string(//teilnehmer[1]/geburtsdatum)'));
$participantTwoBirthDate = trim((string) $xpath->evaluate('string(//teilnehmer[2]/geburtsdatum)'));
$this->assertNotSame('Example', $applicantName);
$this->assertSame($applicantName, $participantOneName);
@@ -76,6 +82,9 @@ XML;
$this->assertSame('01000000002', $participantOneMobilePhone);
$this->assertSame($applicantMobilePhone, $participantOneMobilePhone);
$this->assertNotSame($participantOneName, $participantTwoName);
$this->assertSame('03.04.1991', $applicantBirthDate);
$this->assertSame('03.04.1991', $participantOneBirthDate);
$this->assertSame('12.11.1987', $participantTwoBirthDate);
$this->assertSame(3, $anonymizer->getLastIdentityCount());
}
@@ -181,7 +190,7 @@ XML;
$this->assertSame('Divers', $responseSalutation);
$this->assertSame('', $responseTitle);
$this->assertSame('D', $responseGender);
$this->assertSame('01.01.1980', $responseBirthDate);
$this->assertSame('16.04.1972', $responseBirthDate);
$this->assertSame('XX', $responseNationality);
$this->assertNotSame('Beispielweg 57', $responseStreet);
$this->assertNotSame('42853', $responsePostalCode);
@@ -501,7 +510,7 @@ XML;
$this->assertSame('Divers', $salutation);
$this->assertSame('', $title);
$this->assertSame('D', $gender);
$this->assertSame('01.01.1980', $birthDate);
$this->assertSame('01.02.1990', $birthDate);
$this->assertSame('XX', $nationality);
$this->assertNotSame('Beispielweg 12', $street);
$this->assertNotSame('12345', $postalCode);