Skip to content

Commit

Permalink
Merge cf0e356 into ef78cdb
Browse files Browse the repository at this point in the history
  • Loading branch information
lsolesen committed May 15, 2019
2 parents ef78cdb + cf0e356 commit e8bba69
Show file tree
Hide file tree
Showing 2 changed files with 128 additions and 7 deletions.
18 changes: 15 additions & 3 deletions README.markdown
Expand Up @@ -2,7 +2,7 @@

[![Build Status](https://travis-ci.org/lsolesen/edbbrugs-php-sdk.png?branch=master)](https://travis-ci.org/lsolesen/edbbrugs-php-sdk) [![Code Coverage](https://scrutinizer-ci.com/g/lsolesen/edbbrugs-php-sdk/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/lsolesen/edbbrugs-php-sdk/?branch=master) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/lsolesen/edbbrugs-php-sdk/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/lsolesen/edbbrugs-php-sdk/?branch=master) [![Latest Stable Version](https://poser.pugx.org/lsolesen/edbbrugs-php-sdk/v/stable)](https://packagist.org/packages/lsolesen/edbbrugs-php-sdk) [![Total Downloads](https://poser.pugx.org/lsolesen/edbbrugs-php-sdk/downloads)](https://packagist.org/packages/lsolesen/edbbrugs-php-sdk) [![License](https://poser.pugx.org/lsolesen/edbbrugs-php-sdk/license)](https://packagist.org/packages/lsolesen/edbbrugs-php-sdk)

PHP 5 SDK to communicate with [De frie skolers EDB-BRUGS](http://edb-brugs.dk).
PHP 7 SDK to communicate with [De frie skolers EDB-BRUGS](http://edb-brugs.dk).

## Requirements

Expand All @@ -25,7 +25,7 @@ To get access to the service, you need to contact the [support at EDB-BRUGS](htt

### Composer

Simply add a dependency on lsolesen/edbbrugs-php-sdk to your project's `composer.json` file if you use Composer to manage the dependencies of your project. Here is a minimal example of a composer.json file that just defines a dependency on Billy PHP SDK 2.1:
Simply add a dependency on lsolesen/edbbrugs-php-sdk to your project's `composer.json` file if you use Composer to manage the dependencies of your project. Here is a minimal example of a `composer.json` file that just defines a dependency on EDBBrugs-PHP-SDK:

```
{
Expand All @@ -39,7 +39,7 @@ After running `composer install`, you can take advantage of Composer's autoloade

## Usage

```php5
```php
<?php
use EDBBrugs\Client;
use EDBBrugs\Credentials;
Expand Down Expand Up @@ -97,6 +97,18 @@ $registration_repository->getHandledRegistrations();
?>
```

If you need to put something into custom fields, you will have to do like this:

```php
// Add registrations.
$registrations = array(
array(
'Kartotek' => 'XX', // required - provided by the user of EDB-Brugs
'EgneFelter.EgetFelt30' => '[Forening450l]12.12.2018 Web Ja'
)
);
```

## Testing

You can test the methods on the commandline, by running:
Expand Down
117 changes: 113 additions & 4 deletions tests/RegistrationRepositoryTest.php
Expand Up @@ -44,8 +44,8 @@ public function setUp()
'Kartotek' => 'T3',
'Kursus' => 'Vinterkursus 18/19',
// The following can be repeated for Mor, Far, Voksen
'Elev.Fornavn' => 'Svend Aage',
'Elev.Efternavn' => 'Thomsen',
'Elev.Fornavn' => 'Test Webtilmelding',
'Elev.Efternavn' => 'Vinterkursus',
'Elev.Adresse' => 'Ørnebjergvej 28',
'Elev.Lokalby' => 'Grejs',
'Elev.Kommune' => 'Vejle',
Expand Down Expand Up @@ -102,8 +102,8 @@ public function setUp()
'Kartotek' => 'T3',
'Kursus' => 'Forårskursus 2019 (24 uger) - KUN ENKELTE PIGEPLADSER TILBAGE',
// The following can be repeated for Mor, Far, Voksen
'Elev.Fornavn' => 'Ole',
'Elev.Efternavn' => 'Damgård',
'Elev.Fornavn' => 'Test Webtilmelding',
'Elev.Efternavn' => 'Forårskursus',
'Elev.Adresse' => 'Ørnebjergvej 28, Ørnebjergvej 28, Ørnebjergvej 28',
'Elev.Lokalby' => 'Grejs',
'Elev.Postnr' => '7100',
Expand Down Expand Up @@ -189,6 +189,115 @@ public function testSoapGetNewRegistrationsInteractingWithOnlineWebservice()
}
}

/**
* @group IntegrationTest
*/
public function testDateAllCourses()
{
$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' => 'Uddannelsesfelt',
'Elev.Adresse' => 'Ørnebjergvej 28',
'Elev.Lokalby' => 'Grejs',
'Elev.Kommune' => 'Vejle',
'Elev.Postnr' => '7100',
'Elev.Bynavn' => 'Vejle',
'Elev.CprNr' => '010119421942',
'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.EgetFelt7' => '[Fri082]12.12.2018'
),
);
$this->assertEquals(count($registration), $repository->addRegistrations($registration)->getCount());
}

/**
* @group IntegrationTest
*/
public function testEducationLongCourses()
{
$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' => 'Vinterkursus 18/19',
// The following can be repeated for Mor, Far, Voksen
'Elev.Fornavn' => 'Test Webtilmelding',
'Elev.Efternavn' => 'Uddannelsesfelt',
'Elev.Adresse' => 'Ørnebjergvej 28',
'Elev.Lokalby' => 'Grejs',
'Elev.Kommune' => 'Vejle',
'Elev.Postnr' => '7100',
'Elev.Bynavn' => 'Vejle',
'Elev.CprNr' => '010119421942',
'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.EgetFelt1' => '[Fri132]Har ungdomsuddannelse'
),
);
$this->assertEquals(count($registration), $repository->addRegistrations($registration)->getCount());
}

/**
* @group IntegrationTest
*/
public function testConcentShortCourses()
{
$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' => 'Samtykke',
'Elev.Adresse' => 'Ørnebjergvej 28',
'Elev.Lokalby' => 'Grejs',
'Elev.Kommune' => 'Vejle',
'Elev.Postnr' => '7100',
'Elev.Bynavn' => 'Vejle',
'Elev.CprNr' => '010119421942',
'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'
),
);
$this->assertEquals(count($registration), $repository->addRegistrations($registration)->getCount());
}

/**
* It is not possible to delete using the webservice.
* Just testing whether we get expected response.
Expand Down

0 comments on commit e8bba69

Please sign in to comment.