From 91281f32ee15eeca8c7501ed683e116865909218 Mon Sep 17 00:00:00 2001 From: peter279k Date: Sat, 5 Jan 2019 22:49:26 +0800 Subject: [PATCH] Test enhancement (#26) * fix travis setting * replace PHPUnit namespace * Test enhancement * Test enhancement --- .travis.yml | 2 -- composer.json | 4 ++-- tests/ValidatorTest.php | 9 +++++---- tests/Vies/ClientTest.php | 6 ++++-- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6a3bfb9..02f6c26 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,3 @@ -sudo: false - language: php php: diff --git a/composer.json b/composer.json index 73e4612..3a3c084 100644 --- a/composer.json +++ b/composer.json @@ -15,11 +15,11 @@ } ], "require": { - "php": ">=5.3.0" + "php": ">=5.6.0" }, "require-dev": { "ext-soap": "*", - "phpunit/phpunit": "^4.0 || ^5.0" + "phpunit/phpunit": "^5.7 || ^6.5" }, "suggest": { "ext-soap": "Required if you want to check the VAT number via VIES" diff --git a/tests/ValidatorTest.php b/tests/ValidatorTest.php index 7bc4df8..abfe133 100644 --- a/tests/ValidatorTest.php +++ b/tests/ValidatorTest.php @@ -5,8 +5,9 @@ use Ddeboer\Vatin\Validator; use Ddeboer\Vatin\Test\Mock\Vies\Response\CheckVatResponse; use Ddeboer\Vatin\Vies\Client; +use PHPUnit\Framework\TestCase; -class ValidatorTest extends \PHPUnit_Framework_TestCase +class ValidatorTest extends TestCase { private $validator; @@ -57,11 +58,11 @@ public function testInvalidWithVies() $this->assertFalse($this->validator->isValid('NL123456789B01', true)); } - + /** + * @expectedException \Ddeboer\Vatin\Exception\ViesException + */ public function testWrongConnectionThrowsException() { - $this->setExpectedException('\Ddeboer\Vatin\Exception\ViesException'); - $this->validator = new Validator(new Client('meh')); $this->validator->isValid('NL002065538B01', true); } diff --git a/tests/Vies/ClientTest.php b/tests/Vies/ClientTest.php index 65a0685..9441bdb 100644 --- a/tests/Vies/ClientTest.php +++ b/tests/Vies/ClientTest.php @@ -3,15 +3,17 @@ namespace Ddeboer\Vatin\Test\Vies; use Ddeboer\Vatin\Vies\Client; +use Ddeboer\Vatin\Vies\Response\CheckVatResponse; +use PHPUnit\Framework\TestCase; -class ClientTest extends \PHPUnit_Framework_TestCase +class ClientTest extends TestCase { public function testCheckVat() { $client = new Client(); $response = $client->checkVat('NL', '123456789B01'); - $this->assertInstanceOf('\Ddeboer\Vatin\Vies\Response\CheckVatResponse', $response); + $this->assertInstanceOf(CheckVatResponse::class, $response); $this->assertFalse($response->isValid()); $this->assertEquals('NL', $response->getCountryCode()); $this->assertEquals('123456789B01', $response->getVatNumber());