From 1966abd46c68ef4a3e69c7d08d2f3d993537488f Mon Sep 17 00:00:00 2001 From: Sullivan SENECHAL Date: Thu, 2 Nov 2017 12:31:12 +0100 Subject: [PATCH] PHPUnit v6 compatibility --- composer.json | 7 ++++++- tests/AbstractIsoCodeGenericConstraintTest.php | 3 ++- .../Bridge/Silex/IsoCodesValidatorServiceProviderTest.php | 3 ++- tests/Constraints/AbstractConstraintValidatorTest.php | 3 ++- tests/Constraints/IsbnTest.php | 3 ++- tests/Constraints/ZipCodeTest.php | 3 ++- 6 files changed, 16 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index 333be10..53a77ce 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "symfony/validator": "^2.7 || ^3.0" }, "require-dev": { - "matthiasnoback/symfony-dependency-injection-test": "^0.7.4", + "matthiasnoback/symfony-dependency-injection-test": "^1.0.1 || ^2.0", "sebastian/exporter": "^1.2.0", "silex/silex": "^1.2 || ^2.0", "sllh/php-cs-fixer-styleci-bridge": "^1.0", @@ -45,6 +45,11 @@ "psr-4": { "SLLH\\IsoCodesValidator\\Tests\\": "tests" }, "psr-0": { "IsoCodes\\Tests\\": "vendor/ronanguilloux/isocodes/tests" } }, + "scripts": { + "isocodes-test-namespace": "sed -i 's/PHPUnit_Framework_TestCase/PHPUnit\\\\Framework\\\\TestCase/' vendor/ronanguilloux/isocodes/tests/IsoCodes/Tests/AbstractIsoCodeTest.php", + "post-install-cmd": "@isocodes-test-namespace", + "post-update-cmd": "@isocodes-test-namespace" + }, "config": { "sort-packages": true }, diff --git a/tests/AbstractIsoCodeGenericConstraintTest.php b/tests/AbstractIsoCodeGenericConstraintTest.php index 49c7bef..513a762 100644 --- a/tests/AbstractIsoCodeGenericConstraintTest.php +++ b/tests/AbstractIsoCodeGenericConstraintTest.php @@ -2,6 +2,7 @@ namespace SLLH\IsoCodesValidator\Tests; +use PHPUnit\Framework\TestCase; use SLLH\IsoCodesValidator\AbstractIsoCodesGenericConstraint; use SLLH\IsoCodesValidator\Constraints\Bban; use SLLH\IsoCodesValidator\Constraints\Cif; @@ -11,7 +12,7 @@ /** * @author Sullivan Senechal */ -final class AbstractIsoCodeGenericConstraintTest extends \PHPUnit_Framework_TestCase +final class AbstractIsoCodeGenericConstraintTest extends TestCase { /** * @dataProvider getGenericConstraints diff --git a/tests/Bridge/Silex/IsoCodesValidatorServiceProviderTest.php b/tests/Bridge/Silex/IsoCodesValidatorServiceProviderTest.php index ae25591..3d624ae 100644 --- a/tests/Bridge/Silex/IsoCodesValidatorServiceProviderTest.php +++ b/tests/Bridge/Silex/IsoCodesValidatorServiceProviderTest.php @@ -2,6 +2,7 @@ namespace SLLH\IsoCodesValidator\Tests\Bridge\Silex; +use PHPUnit\Framework\TestCase; use Silex\Application; use Silex\Provider\LocaleServiceProvider; use Silex\Provider\TranslationServiceProvider; @@ -12,7 +13,7 @@ /** * @author Sullivan Senechal */ -final class IsoCodesValidatorServiceProviderTest extends \PHPUnit_Framework_TestCase +final class IsoCodesValidatorServiceProviderTest extends TestCase { public function testRegisterAndBoot() { diff --git a/tests/Constraints/AbstractConstraintValidatorTest.php b/tests/Constraints/AbstractConstraintValidatorTest.php index 598c9c3..7fb63da 100644 --- a/tests/Constraints/AbstractConstraintValidatorTest.php +++ b/tests/Constraints/AbstractConstraintValidatorTest.php @@ -7,6 +7,7 @@ use SLLH\IsoCodesValidator\ConstraintInterface; use SLLH\IsoCodesValidator\Constraints\IsoCodesGenericValidator; use Symfony\Component\Validator\Constraints\Blank; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; use Symfony\Component\Validator\Tests\Constraints\AbstractConstraintValidatorTest as BaseAbstractConstraintValidatorTest; use Symfony\Component\Validator\Validation; @@ -35,7 +36,7 @@ protected function getApiVersion() public function testUnexpectedConstraintException() { - $this->setExpectedException('Symfony\Component\Validator\Exception\UnexpectedTypeException'); + $this->expectException(UnexpectedTypeException::class); $this->validator->validate(null, new Blank()); } diff --git a/tests/Constraints/IsbnTest.php b/tests/Constraints/IsbnTest.php index 36f5ef7..3c4dfdf 100644 --- a/tests/Constraints/IsbnTest.php +++ b/tests/Constraints/IsbnTest.php @@ -2,9 +2,10 @@ namespace SLLH\IsoCodesValidator\Tests\Constraints; +use PHPUnit\Framework\TestCase; use SLLH\IsoCodesValidator\Constraints\Isbn; -final class IsbnTest extends \PHPUnit_Framework_TestCase +final class IsbnTest extends TestCase { /** * @dataProvider getValidTypes diff --git a/tests/Constraints/ZipCodeTest.php b/tests/Constraints/ZipCodeTest.php index 44a4430..3bc51fc 100644 --- a/tests/Constraints/ZipCodeTest.php +++ b/tests/Constraints/ZipCodeTest.php @@ -2,9 +2,10 @@ namespace SLLH\IsoCodesValidator\Tests\Constraints; +use PHPUnit\Framework\TestCase; use SLLH\IsoCodesValidator\Constraints\ZipCode; -final class ZipCodeTest extends \PHPUnit_Framework_TestCase +final class ZipCodeTest extends TestCase { /** * @dataProvider getValidCountries