Skip to content

Commit

Permalink
Added support for & htmlspecialchars (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
lsolesen committed Feb 7, 2020
1 parent 6b9b383 commit 5dd338f
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/Client.php
Expand Up @@ -102,7 +102,7 @@ public function createNewRegistrations(array $registrations)
if (strpos($key, '.Kommune') !== false) {
$value = $this->getUtilityClass()->getMunicipalityCode($value);
}
$reg->addChild($key, $value);
$reg->addChild($key, htmlspecialchars($value));
}
}

Expand Down
85 changes: 78 additions & 7 deletions tests/RegistrationRepositoryTest.php
Expand Up @@ -51,7 +51,7 @@ public function setUp()
'Elev.Kommune' => 'Vejle',
'Elev.Postnr' => '7100',
'Elev.Bynavn' => 'Vejle',
'Elev.CprNr' => '010119421942',
'Elev.CprNr' => '0101421942',
'Elev.Fastnet' => '+46 70 716 31 39',
'Elev.FastnetBeskyttet' => 0, // 0 = No, 1 = Yes
'Elev.Mobil' => '75820811',
Expand Down Expand Up @@ -109,7 +109,7 @@ public function setUp()
'Elev.Postnr' => '7100',
'Elev.Bynavn' => 'Vejle',
'Elev.Kommune' => 'Vejle',
'Elev.CprNr' => '010119421942',
'Elev.CprNr' => '0101421942',
'Elev.Fastnet' => '+45 75 82 08 11',
'Elev.FastnetBeskyttet' => 0, // 0 = No, 1 = Yes
'Elev.Mobil' => '75820811',
Expand Down Expand Up @@ -212,7 +212,7 @@ public function testDateAllCourses()
'Elev.Kommune' => 'Vejle',
'Elev.Postnr' => '7100',
'Elev.Bynavn' => 'Vejle',
'Elev.CprNr' => '010119421942',
'Elev.CprNr' => '0101421942',
'Elev.Fastnet' => '+46 70 716 31 39',
'Elev.FastnetBeskyttet' => 0, // 0 = No, 1 = Yes
'Elev.Mobil' => '75820811',
Expand Down Expand Up @@ -248,7 +248,7 @@ public function testEducationLongCourses()
'Elev.Kommune' => 'Vejle',
'Elev.Postnr' => '7100',
'Elev.Bynavn' => 'Vejle',
'Elev.CprNr' => '010119421942',
'Elev.CprNr' => '0101421942',
'Elev.Fastnet' => '+46 70 716 31 39',
'Elev.FastnetBeskyttet' => 0, // 0 = No, 1 = Yes
'Elev.Mobil' => '75820811',
Expand All @@ -264,7 +264,7 @@ public function testEducationLongCourses()
/**
* @group IntegrationTest
*/
public function testConcentShortCourses()
public function testConcentGdprMarketingCourses()
{
$this->soap = new \SoapClient(WSDL, array('trace' => 1));
$credentials = new Credentials(USERNAME, PASSWORD, SKOLEKODE);
Expand All @@ -284,15 +284,86 @@ public function testConcentShortCourses()
'Elev.Kommune' => 'Vejle',
'Elev.Postnr' => '7100',
'Elev.Bynavn' => 'Vejle',
'Elev.CprNr' => '010119421942',
'Elev.CprNr' => '0101421942',
'Elev.Fastnet' => '+46 70 716 31 39',
'Elev.FastnetBeskyttet' => 0, // 0 = No, 1 = Yes
'Elev.Mobil' => '75820811',
'Elev.MobilBeskyttet' => 0, // 0 = No, 1 = Yes
'Elev.Email' => 'kontor@vih.dk',
'Elev.Land' => 'Danmark',
'EgneFelter.EgetFelt30' => '[Fri084]Ja',
'EgneFelter.EgetFelt29' => '[Forening4501]12.12.2018 Web Ja'
'EgneFelter.EgetFelt29' => '[Forening4501]12.12.2018 Web Ja',
'EgneFelter.EgetFelt28' => '[Forening4502]12.12.2018 Web Ja'
),
);
$this->assertEquals(count($registration), $repository->addRegistrations($registration)->getCount());
}

/**
* @group IntegrationTest
*/
public function testBirthdayOnlyCourses()
{
$this->soap = new \SoapClient(WSDL, array('trace' => 1));
$credentials = new Credentials(USERNAME, PASSWORD, SKOLEKODE);
$client = new Client($credentials, $this->soap);

$repository = new RegistrationRepository($client);

$registration = array(
array(
'Kartotek' => 'T3',
'Kursus' => 'Fitness 360, uge 30 2019',
// The following can be repeated for Mor, Far, Voksen
'Elev.Fornavn' => 'Test Webtilmelding',
'Elev.Efternavn' => 'Birthday Only',
'Elev.Adresse' => 'Ørnebjergvej 28',
'Elev.Lokalby' => 'Grejs',
'Elev.Kommune' => 'Vejle',
'Elev.Postnr' => '7100',
'Elev.Bynavn' => 'Vejle',
'Elev.CprNr' => '010142',
'Elev.Fastnet' => '+46 70 716 31 39',
'Elev.FastnetBeskyttet' => 0, // 0 = No, 1 = Yes
'Elev.Mobil' => '75820811',
'Elev.MobilBeskyttet' => 0, // 0 = No, 1 = Yes
'Elev.Email' => 'kontor@vih.dk',
'Elev.Land' => 'Danmark'
),
);
$this->assertEquals(count($registration), $repository->addRegistrations($registration)->getCount());
}

/**
* @group IntegrationTest
*/
public function testNameWithAndSign()
{
$this->soap = new \SoapClient(WSDL, array('trace' => 1));
$credentials = new Credentials(USERNAME, PASSWORD, SKOLEKODE);
$client = new Client($credentials, $this->soap);

$repository = new RegistrationRepository($client);

$registration = array(
array(
'Kartotek' => 'T3',
'Kursus' => 'Body & Mind, uge 30 2019',
// The following can be repeated for Mor, Far, Voksen
'Elev.Fornavn' => 'Test Webtilmelding And Sign',
'Elev.Efternavn' => 'And Sign',
'Elev.Adresse' => 'Ørnebjergvej 28',
'Elev.Lokalby' => 'Grejs',
'Elev.Kommune' => 'Vejle',
'Elev.Postnr' => '7100',
'Elev.Bynavn' => 'Vejle',
'Elev.CprNr' => '010142',
'Elev.Fastnet' => '+46 70 716 31 39',
'Elev.FastnetBeskyttet' => 0, // 0 = No, 1 = Yes
'Elev.Mobil' => '75820811',
'Elev.MobilBeskyttet' => 0, // 0 = No, 1 = Yes
'Elev.Email' => 'kontor@vih.dk',
'Elev.Land' => 'Danmark'
),
);
$this->assertEquals(count($registration), $repository->addRegistrations($registration)->getCount());
Expand Down

0 comments on commit 5dd338f

Please sign in to comment.