fix: retain original date of birth when anonymizing xml dumps
This commit is contained in:
@@ -202,8 +202,6 @@ class BpnXmlAnonymizer
|
||||
$title = '';
|
||||
$gender = 'D';
|
||||
$nationality = 'XX';
|
||||
$birthDate = '01.01.1980';
|
||||
|
||||
$street = sprintf('%s %s', $this->faker->streetName(), $this->faker->buildingNumber());
|
||||
$postalCode = $this->faker->postcode();
|
||||
$city = $this->faker->city();
|
||||
@@ -232,7 +230,6 @@ class BpnXmlAnonymizer
|
||||
'title' => $title,
|
||||
'gender' => $gender,
|
||||
'nationality' => $nationality,
|
||||
'birthDate' => $birthDate,
|
||||
'street' => $street,
|
||||
'postalCode' => $postalCode,
|
||||
'city' => $city,
|
||||
@@ -389,11 +386,6 @@ class BpnXmlAnonymizer
|
||||
$this->replaceNodeValue($nationalityNode, $identity['nationality']);
|
||||
}
|
||||
|
||||
$birthDateNode = $this->getDirectChild($personNode, 'geburtsdatum');
|
||||
if (null !== $birthDateNode) {
|
||||
$this->replaceNodeValue($birthDateNode, $identity['birthDate']);
|
||||
}
|
||||
|
||||
$heightNode = $this->getDirectChild($personNode, 'sonstiges1');
|
||||
if (null !== $heightNode) {
|
||||
$this->replaceNodeValue($heightNode, $identity['height']);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user