diff --git a/.gitignore b/.gitignore index 338614f..14aefa0 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,6 @@ vendor // OSX .DS_Store + +// Phpunit +.phpunit.result.cache diff --git a/.travis.yml b/.travis.yml index 790b541..938c688 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,9 @@ language: php php: - - 5.4 - - 5.5 - - 5.6 - - 5.5 - - 7.0 + - 7.1 + - 7.2 + - 7.3 before_install: - phpenv config-rm xdebug.ini diff --git a/README.md b/README.md index 576224e..e86bdec 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ [![License](https://poser.pugx.org/ffwagency/borgerdk-php/license)](https://packagist.org/packages/ffwagency/borgerdk-php) ## Requirements -* PHP 5.4+ +* PHP 7.1+ ## Installation diff --git a/composer.json b/composer.json index c308fce..57f0f40 100644 --- a/composer.json +++ b/composer.json @@ -13,12 +13,12 @@ } ], "require": { - "php": ">=5.4.0", - "symfony/dom-crawler": "2.8.*|3.2.*", - "symfony/css-selector": "2.8.*|3.2.*" + "php": ">=7.1.0", + "symfony/dom-crawler": "2.8.* || 3.4.* || 4.4.*", + "symfony/css-selector": "2.8.* || 3.4.* || 4.4.*" }, "require-dev": { - "phpunit/phpunit": "4.8.*" + "phpunit/phpunit": "~6.5 || ~7 || ~8.4" }, "autoload": { "psr-4": { diff --git a/src/BorgerDk/ArticleService/Client.php b/src/BorgerDk/ArticleService/Client.php index ac27c37..6bc6f75 100755 --- a/src/BorgerDk/ArticleService/Client.php +++ b/src/BorgerDk/ArticleService/Client.php @@ -33,7 +33,8 @@ class Client * * @var string */ - protected $soapUrl = 'https://www.borger.dk/_vti_bin/borger/ArticleExport.svc?wsdl'; + protected $soapUrlDa = 'https://www.borger.dk/_vti_bin/borger/ArticleExport.svc?wsdl'; + protected $soapUrlEn = 'https://lifeindenmark.borger.dk/_vti_bin/borger/ArticleExport.svc?wsdl'; /** * Array with debug options @@ -45,12 +46,15 @@ class Client /** * Initiate the SoapClient connection. * + * @param string $lang + * * @throws \BorgerDk\ArticleService\Exceptions\SoapException */ - public function __construct() + public function __construct($lang = 'da') { try { - $this->client = new SoapClient($this->soapUrl, $this->debug); + $soapUrl = (strcasecmp($lang, 'en') == 0) ? $this->soapUrlEn : $this->soapUrlDa; + $this->client = new SoapClient($soapUrl, $this->debug); } catch (\SoapFault $fault) { new SoapException($fault); } diff --git a/tests/BorgerDk/ArticleService/UnitTests/BasicTest.php b/tests/BorgerDk/ArticleService/UnitTests/BasicTest.php index ebf6a21..d24fa2c 100644 --- a/tests/BorgerDk/ArticleService/UnitTests/BasicTest.php +++ b/tests/BorgerDk/ArticleService/UnitTests/BasicTest.php @@ -11,7 +11,7 @@ namespace BorgerDk\ArticleService\UnitTests; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase as UnitTestCase; use BorgerDk\ArticleService; use BorgerDk\ArticleService\Client as Client; @@ -20,7 +20,7 @@ * * @package BorgerDk\ArticleService */ -abstract class BasicTest extends \PHPUnit_Framework_TestCase +abstract class BasicTest extends UnitTestCase { /** * Client Connection @@ -83,8 +83,9 @@ public function __construct($name = null, array $data = array(), $dataName = '') /** * Initiate the new Soap Client in the setup method. */ - protected function setUp() + protected function setUp(): void { + parent::setUp(); $this->client = new Client(); } } diff --git a/tests/BorgerDk/ArticleService/UnitTests/Resources/Endpoints/GetAllArticlesTest.php b/tests/BorgerDk/ArticleService/UnitTests/Resources/Endpoints/GetAllArticlesTest.php index 63babb9..c3c9554 100644 --- a/tests/BorgerDk/ArticleService/UnitTests/Resources/Endpoints/GetAllArticlesTest.php +++ b/tests/BorgerDk/ArticleService/UnitTests/Resources/Endpoints/GetAllArticlesTest.php @@ -29,7 +29,7 @@ class GetAllArticlesTest extends BasicTest /** * Setup the endpoint request. */ - public function setUp() + public function setUp(): void { parent::setUp(); $this->endpoint = new GetAllArticles($this->client); diff --git a/tests/BorgerDk/ArticleService/UnitTests/Resources/Endpoints/GetAllSitesTest.php b/tests/BorgerDk/ArticleService/UnitTests/Resources/Endpoints/GetAllSitesTest.php index 0563b08..e1eddb7 100644 --- a/tests/BorgerDk/ArticleService/UnitTests/Resources/Endpoints/GetAllSitesTest.php +++ b/tests/BorgerDk/ArticleService/UnitTests/Resources/Endpoints/GetAllSitesTest.php @@ -19,7 +19,7 @@ * * @package BorgerDk\ArticleService */ -class GetAllSitesTEst extends BasicTest +class GetAllSitesTest extends BasicTest { /** * @var object @@ -29,7 +29,7 @@ class GetAllSitesTEst extends BasicTest /** * Setup the endpoint request. */ - public function setUp() + public function setUp(): void { parent::setUp(); $this->endpoint = new GetAllSites($this->client); diff --git a/tests/BorgerDk/ArticleService/UnitTests/Resources/Endpoints/GetArticleByIDTest.php b/tests/BorgerDk/ArticleService/UnitTests/Resources/Endpoints/GetArticleByIDTest.php index bcfaf14..c167f24 100644 --- a/tests/BorgerDk/ArticleService/UnitTests/Resources/Endpoints/GetArticleByIDTest.php +++ b/tests/BorgerDk/ArticleService/UnitTests/Resources/Endpoints/GetArticleByIDTest.php @@ -29,7 +29,7 @@ class GetArticleByIDTest extends BasicTest /** * Setup the endpoint request. */ - public function setUp() + public function setUp(): void { parent::setUp(); $params = array('articleID' => $this->articleId1, 'municipalityCode' => $this->municipalityCode); diff --git a/tests/BorgerDk/ArticleService/UnitTests/Resources/Endpoints/GetArticleIDByUrlTest.php b/tests/BorgerDk/ArticleService/UnitTests/Resources/Endpoints/GetArticleIDByUrlTest.php index 8e50c71..2793128 100644 --- a/tests/BorgerDk/ArticleService/UnitTests/Resources/Endpoints/GetArticleIDByUrlTest.php +++ b/tests/BorgerDk/ArticleService/UnitTests/Resources/Endpoints/GetArticleIDByUrlTest.php @@ -29,7 +29,7 @@ class GetArticleIDByUrlTest extends BasicTest /** * Setup the endpoint request. */ - public function setUp() + public function setUp(): void { parent::setUp(); $params = array('url' => $this->articleUrl); diff --git a/tests/BorgerDk/ArticleService/UnitTests/Resources/Endpoints/GetArticleIDsBySiteIDTest.php b/tests/BorgerDk/ArticleService/UnitTests/Resources/Endpoints/GetArticleIDsBySiteIDTest.php index 7ae3e77..1c7c533 100644 --- a/tests/BorgerDk/ArticleService/UnitTests/Resources/Endpoints/GetArticleIDsBySiteIDTest.php +++ b/tests/BorgerDk/ArticleService/UnitTests/Resources/Endpoints/GetArticleIDsBySiteIDTest.php @@ -29,7 +29,7 @@ class GetArticleIDsBySiteIDTest extends BasicTest /** * Setup the endpoint request. */ - public function setUp() + public function setUp(): void { parent::setUp(); $params = array('siteID' => $this->siteId); diff --git a/tests/BorgerDk/ArticleService/UnitTests/Resources/Endpoints/GetArticlesByIDsTest.php b/tests/BorgerDk/ArticleService/UnitTests/Resources/Endpoints/GetArticlesByIDsTest.php index 83c677c..035331a 100644 --- a/tests/BorgerDk/ArticleService/UnitTests/Resources/Endpoints/GetArticlesByIDsTest.php +++ b/tests/BorgerDk/ArticleService/UnitTests/Resources/Endpoints/GetArticlesByIDsTest.php @@ -29,7 +29,7 @@ class GetArticlesByIDsTest extends BasicTest /** * Setup the endpoint request. */ - public function setUp() + public function setUp(): void { parent::setUp(); $articleIds = array($this->articleId1, $this->articleId2); diff --git a/tests/BorgerDk/ArticleService/UnitTests/Resources/Endpoints/GetMunicipalityListTest.php b/tests/BorgerDk/ArticleService/UnitTests/Resources/Endpoints/GetMunicipalityListTest.php index 53427ec..abf0161 100644 --- a/tests/BorgerDk/ArticleService/UnitTests/Resources/Endpoints/GetMunicipalityListTest.php +++ b/tests/BorgerDk/ArticleService/UnitTests/Resources/Endpoints/GetMunicipalityListTest.php @@ -29,7 +29,7 @@ class GetMunicipalityListTest extends BasicTest /** * Setup the endpoint request. */ - public function setUp() + public function setUp(): void { parent::setUp(); $this->endpoint = new GetMunicipalityList($this->client);