From 71b02d5c84c3dced6285faa7282858aa6da70e98 Mon Sep 17 00:00:00 2001 From: Bojan Zivanovic Date: Fri, 24 Jan 2020 17:14:25 +0100 Subject: [PATCH] Drop PHP 5 support completely, upgrade to PHPUnit 6. --- .travis.yml | 1 - README.md | 2 +- composer.json | 6 +++--- tests/AbstractEnumTest.php | 3 ++- tests/AddressFormat/AddressFormatHelperTest.php | 3 ++- tests/AddressFormat/AddressFormatRepositoryTest.php | 3 ++- tests/AddressFormat/AddressFormatTest.php | 3 ++- tests/AddressFormat/FieldOverridesTest.php | 3 ++- tests/AddressTest.php | 3 ++- tests/Country/CountryRepositoryTest.php | 3 ++- tests/Country/CountryTest.php | 6 ++++-- tests/Formatter/DefaultFormatterTest.php | 5 +++-- tests/Formatter/PostalLabelFormatterTest.php | 5 +++-- tests/LocaleTest.php | 5 +++-- tests/PostalCodeHelperTest.php | 3 ++- tests/Subdivision/LazySubdivisionCollectionTest.php | 5 +++-- tests/Subdivision/SubdivisionRepositoryTest.php | 3 ++- tests/Subdivision/SubdivisionTest.php | 3 ++- tests/UpdateHelperTest.php | 3 ++- .../Constraints/AddressFormatConstraintValidatorTest.php | 4 ++-- .../Constraints/CountryConstraintValidatorTest.php | 4 ++-- tests/Zone/ZoneTerritoryTest.php | 3 ++- tests/Zone/ZoneTest.php | 3 ++- 23 files changed, 50 insertions(+), 32 deletions(-) diff --git a/.travis.yml b/.travis.yml index 29bd0b60..a08f7c42 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,6 @@ php: - 7.2 - 7.1 - 7.0 - - 5.6 install: - composer self-update diff --git a/README.md b/README.md index 50f7ea15..19d14972 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ addressing [![Build Status](https://travis-ci.org/commerceguys/addressing.svg?branch=master)](https://travis-ci.org/commerceguys/addressing) -A PHP 5.5+ addressing library, powered by CLDR and Google's address data. +A PHP 7.0+ addressing library, powered by CLDR and Google's address data. Manipulates postal addresses, meant to identify a precise recipient location for shipping or billing purposes. diff --git a/composer.json b/composer.json index 53e1d3df..cf8fcec5 100644 --- a/composer.json +++ b/composer.json @@ -5,12 +5,12 @@ "keywords": ["postal", "address", "internationalization", "localization"], "license": "MIT", "require": { - "php": ">=5.5.0", + "php": ">=7.0.8", "doctrine/collections": "~1.0" }, "require-dev": { - "symfony/validator": ">=3.2", - "phpunit/phpunit": "~4.0", + "symfony/validator": "^3.4", + "phpunit/phpunit": "^6.0", "mikey179/vfsstream": "1.*", "squizlabs/php_codesniffer": "2.*" }, diff --git a/tests/AbstractEnumTest.php b/tests/AbstractEnumTest.php index c1d2b2c8..2c171ebd 100644 --- a/tests/AbstractEnumTest.php +++ b/tests/AbstractEnumTest.php @@ -3,11 +3,12 @@ namespace CommerceGuys\Addressing\Tests; use CommerceGuys\Addressing\Subdivision\PatternType; +use PHPUnit\Framework\TestCase; /** * @coversDefaultClass \CommerceGuys\Addressing\AbstractEnum */ -class AbstractEnumTest extends \PHPUnit_Framework_TestCase +final class AbstractEnumTest extends TestCase { /** * @covers ::getAll diff --git a/tests/AddressFormat/AddressFormatHelperTest.php b/tests/AddressFormat/AddressFormatHelperTest.php index 05fa4cdd..eb4be7cb 100644 --- a/tests/AddressFormat/AddressFormatHelperTest.php +++ b/tests/AddressFormat/AddressFormatHelperTest.php @@ -7,11 +7,12 @@ use CommerceGuys\Addressing\AddressFormat\AddressFormatHelper; use CommerceGuys\Addressing\AddressFormat\FieldOverride; use CommerceGuys\Addressing\AddressFormat\FieldOverrides; +use PHPUnit\Framework\TestCase; /** * @coversDefaultClass \CommerceGuys\Addressing\AddressFormat\AddressFormatHelper */ -class AddressFormatHelperTest extends \PHPUnit_Framework_TestCase +final class AddressFormatHelperTest extends TestCase { /** * @covers ::getGroupedFields diff --git a/tests/AddressFormat/AddressFormatRepositoryTest.php b/tests/AddressFormat/AddressFormatRepositoryTest.php index 74130949..bda56284 100644 --- a/tests/AddressFormat/AddressFormatRepositoryTest.php +++ b/tests/AddressFormat/AddressFormatRepositoryTest.php @@ -7,11 +7,12 @@ use CommerceGuys\Addressing\AddressFormat\AdministrativeAreaType; use CommerceGuys\Addressing\AddressFormat\LocalityType; use CommerceGuys\Addressing\AddressFormat\PostalCodeType; +use PHPUnit\Framework\TestCase; /** * @coversDefaultClass \CommerceGuys\Addressing\AddressFormat\AddressFormatRepository */ -class AddressFormatRepositoryTest extends \PHPUnit_Framework_TestCase +final class AddressFormatRepositoryTest extends TestCase { /** * @covers ::get diff --git a/tests/AddressFormat/AddressFormatTest.php b/tests/AddressFormat/AddressFormatTest.php index 49c16be6..5422af45 100644 --- a/tests/AddressFormat/AddressFormatTest.php +++ b/tests/AddressFormat/AddressFormatTest.php @@ -8,11 +8,12 @@ use CommerceGuys\Addressing\AddressFormat\DependentLocalityType; use CommerceGuys\Addressing\AddressFormat\LocalityType; use CommerceGuys\Addressing\AddressFormat\PostalCodeType; +use PHPUnit\Framework\TestCase; /** * @coversDefaultClass \CommerceGuys\Addressing\AddressFormat\AddressFormat */ -class AddressFormatTest extends \PHPUnit_Framework_TestCase +final class AddressFormatTest extends TestCase { /** * @covers ::__construct diff --git a/tests/AddressFormat/FieldOverridesTest.php b/tests/AddressFormat/FieldOverridesTest.php index dcd2e027..c47b3c2f 100644 --- a/tests/AddressFormat/FieldOverridesTest.php +++ b/tests/AddressFormat/FieldOverridesTest.php @@ -5,11 +5,12 @@ use CommerceGuys\Addressing\AddressFormat\AddressField; use CommerceGuys\Addressing\AddressFormat\FieldOverride; use CommerceGuys\Addressing\AddressFormat\FieldOverrides; +use PHPUnit\Framework\TestCase; /** * @coversDefaultClass \CommerceGuys\Addressing\AddressFormat\FieldOverrides */ -class FieldOverridesTest extends \PHPUnit_Framework_TestCase +final class FieldOverridesTest extends TestCase { /** * @covers ::__construct diff --git a/tests/AddressTest.php b/tests/AddressTest.php index a8a3bdc2..fe6be5c4 100644 --- a/tests/AddressTest.php +++ b/tests/AddressTest.php @@ -3,11 +3,12 @@ namespace CommerceGuys\Addressing\Tests; use CommerceGuys\Addressing\Address; +use PHPUnit\Framework\TestCase; /** * @coversDefaultClass \CommerceGuys\Addressing\Address */ -class AddressTest extends \PHPUnit_Framework_TestCase +final class AddressTest extends TestCase { /** * @covers ::__construct diff --git a/tests/Country/CountryRepositoryTest.php b/tests/Country/CountryRepositoryTest.php index 2b80ef2e..ea4444fd 100644 --- a/tests/Country/CountryRepositoryTest.php +++ b/tests/Country/CountryRepositoryTest.php @@ -5,11 +5,12 @@ use CommerceGuys\Addressing\Country\Country; use CommerceGuys\Addressing\Country\CountryRepository; use org\bovigo\vfs\vfsStream; +use PHPUnit\Framework\TestCase; /** * @coversDefaultClass \CommerceGuys\Addressing\Country\CountryRepository */ -class CountryRepositoryTest extends \PHPUnit_Framework_TestCase +final class CountryRepositoryTest extends TestCase { /** * Country definitions. diff --git a/tests/Country/CountryTest.php b/tests/Country/CountryTest.php index 44a554d0..2b2f9ac7 100644 --- a/tests/Country/CountryTest.php +++ b/tests/Country/CountryTest.php @@ -3,18 +3,20 @@ namespace CommerceGuys\Addressing\Tests\Country; use CommerceGuys\Addressing\Country\Country; +use PHPUnit\Framework\TestCase; /** * @coversDefaultClass \CommerceGuys\Addressing\Country\Country */ -class CountryTest extends \PHPUnit_Framework_TestCase +final class CountryTest extends TestCase { /** * @covers ::__construct */ public function testMissingProperty() { - $this->setExpectedException(\InvalidArgumentException::class, 'Missing required property "country_code".'); + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('Missing required property "country_code".'); $country = new Country([]); } diff --git a/tests/Formatter/DefaultFormatterTest.php b/tests/Formatter/DefaultFormatterTest.php index 2d75e6b1..582b06d6 100644 --- a/tests/Formatter/DefaultFormatterTest.php +++ b/tests/Formatter/DefaultFormatterTest.php @@ -7,11 +7,12 @@ use CommerceGuys\Addressing\Country\CountryRepository; use CommerceGuys\Addressing\Formatter\DefaultFormatter; use CommerceGuys\Addressing\Subdivision\SubdivisionRepository; +use PHPUnit\Framework\TestCase; /** * @coversDefaultClass \CommerceGuys\Addressing\Formatter\DefaultFormatter */ -class DefaultFormatterTest extends \PHPUnit_Framework_TestCase +final class DefaultFormatterTest extends TestCase { /** * The address format repository. @@ -44,7 +45,7 @@ class DefaultFormatterTest extends \PHPUnit_Framework_TestCase /** * {@inheritdoc} */ - public function setUp() + protected function setUp() { $this->addressFormatRepository = new AddressFormatRepository(); $this->countryRepository = new CountryRepository(); diff --git a/tests/Formatter/PostalLabelFormatterTest.php b/tests/Formatter/PostalLabelFormatterTest.php index 3e916e7f..fa46bdd5 100644 --- a/tests/Formatter/PostalLabelFormatterTest.php +++ b/tests/Formatter/PostalLabelFormatterTest.php @@ -7,11 +7,12 @@ use CommerceGuys\Addressing\Country\CountryRepository; use CommerceGuys\Addressing\Formatter\PostalLabelFormatter; use CommerceGuys\Addressing\Subdivision\SubdivisionRepository; +use PHPUnit\Framework\TestCase; /** * @coversDefaultClass \CommerceGuys\Addressing\Formatter\PostalLabelFormatter */ -class PostalLabelFormatterTest extends \PHPUnit_Framework_TestCase +final class PostalLabelFormatterTest extends TestCase { /** * The address format repository. @@ -44,7 +45,7 @@ class PostalLabelFormatterTest extends \PHPUnit_Framework_TestCase /** * {@inheritdoc} */ - public function setUp() + protected function setUp() { $this->addressFormatRepository = new AddressFormatRepository(); $this->countryRepository = new CountryRepository(); diff --git a/tests/LocaleTest.php b/tests/LocaleTest.php index 3c65ec2a..93ad1daf 100644 --- a/tests/LocaleTest.php +++ b/tests/LocaleTest.php @@ -4,11 +4,12 @@ use CommerceGuys\Addressing\Exception\UnknownLocaleException; use CommerceGuys\Addressing\Locale; +use PHPUnit\Framework\TestCase; /** * @coversDefaultClass \CommerceGuys\Addressing\Locale */ -class LocaleTest extends \PHPUnit_Framework_TestCase +final class LocaleTest extends TestCase { /** * @covers ::match @@ -57,7 +58,7 @@ public function testResolve() */ public function testResolveWithoutResult() { - $this->setExpectedException(UnknownLocaleException::class); + $this->expectException(UnknownLocaleException::class); $availableLocales = ['bs', 'en']; $locale = Locale::resolve($availableLocales, 'de'); } diff --git a/tests/PostalCodeHelperTest.php b/tests/PostalCodeHelperTest.php index da90c222..5c3a93c5 100644 --- a/tests/PostalCodeHelperTest.php +++ b/tests/PostalCodeHelperTest.php @@ -3,11 +3,12 @@ namespace CommerceGuys\Addressing\Tests; use CommerceGuys\Addressing\PostalCodeHelper; +use PHPUnit\Framework\TestCase; /** * @coversDefaultClass \CommerceGuys\Addressing\PostalCodeHelper */ -class PostalCodeHelperTest extends \PHPUnit_Framework_TestCase +final class PostalCodeHelperTest extends TestCase { /** * @covers ::match diff --git a/tests/Subdivision/LazySubdivisionCollectionTest.php b/tests/Subdivision/LazySubdivisionCollectionTest.php index 439516df..6f75b03b 100644 --- a/tests/Subdivision/LazySubdivisionCollectionTest.php +++ b/tests/Subdivision/LazySubdivisionCollectionTest.php @@ -3,11 +3,12 @@ namespace CommerceGuys\Addressing\Tests\Subdivision; use CommerceGuys\Addressing\Subdivision\LazySubdivisionCollection; +use PHPUnit\Framework\TestCase; /** * @coversDefaultClass \CommerceGuys\Addressing\Subdivision\LazySubdivisionCollection */ -class LazySubdivisionCollectionTest extends \PHPUnit_Framework_TestCase +final class LazySubdivisionCollectionTest extends TestCase { /** * @var LazySubdivisionCollection @@ -17,7 +18,7 @@ class LazySubdivisionCollectionTest extends \PHPUnit_Framework_TestCase /** * {@inheritdoc} */ - public function setUp() + protected function setUp() { $this->collection = new LazySubdivisionCollection(['BR', 'Porto Acre']); } diff --git a/tests/Subdivision/SubdivisionRepositoryTest.php b/tests/Subdivision/SubdivisionRepositoryTest.php index 41ea751c..eede0471 100644 --- a/tests/Subdivision/SubdivisionRepositoryTest.php +++ b/tests/Subdivision/SubdivisionRepositoryTest.php @@ -5,11 +5,12 @@ use CommerceGuys\Addressing\Subdivision\Subdivision; use CommerceGuys\Addressing\Subdivision\SubdivisionRepository; use org\bovigo\vfs\vfsStream; +use PHPUnit\Framework\TestCase; /** * @coversDefaultClass \CommerceGuys\Addressing\Subdivision\SubdivisionRepository */ -class SubdivisionRepositoryTest extends \PHPUnit_Framework_TestCase +final class SubdivisionRepositoryTest extends TestCase { /** * Subdivisions. diff --git a/tests/Subdivision/SubdivisionTest.php b/tests/Subdivision/SubdivisionTest.php index 3f7146c8..112ccab3 100644 --- a/tests/Subdivision/SubdivisionTest.php +++ b/tests/Subdivision/SubdivisionTest.php @@ -5,11 +5,12 @@ use CommerceGuys\Addressing\Subdivision\PatternType; use CommerceGuys\Addressing\Subdivision\Subdivision; use Doctrine\Common\Collections\ArrayCollection; +use PHPUnit\Framework\TestCase; /** * @coversDefaultClass \CommerceGuys\Addressing\Subdivision\Subdivision */ -class SubdivisionTest extends \PHPUnit_Framework_TestCase +final class SubdivisionTest extends TestCase { /** * @covers ::__construct diff --git a/tests/UpdateHelperTest.php b/tests/UpdateHelperTest.php index 4f307a8a..1ea2fabe 100644 --- a/tests/UpdateHelperTest.php +++ b/tests/UpdateHelperTest.php @@ -3,11 +3,12 @@ namespace CommerceGuys\Addressing\Tests; use CommerceGuys\Addressing\UpdateHelper; +use PHPUnit\Framework\TestCase; /** * @coversDefaultClass \CommerceGuys\Addressing\UpdateHelper */ -class UpdateHelperTest extends \PHPUnit_Framework_TestCase +final class UpdateHelperTest extends TestCase { /** * @covers ::splitRecipient diff --git a/tests/Validator/Constraints/AddressFormatConstraintValidatorTest.php b/tests/Validator/Constraints/AddressFormatConstraintValidatorTest.php index 35f65294..67b0ab0e 100644 --- a/tests/Validator/Constraints/AddressFormatConstraintValidatorTest.php +++ b/tests/Validator/Constraints/AddressFormatConstraintValidatorTest.php @@ -13,7 +13,7 @@ /** * @coversDefaultClass \CommerceGuys\Addressing\Validator\Constraints\AddressFormatConstraintValidator */ -class AddressFormatConstraintValidatorTest extends ConstraintValidatorTestCase +final class AddressFormatConstraintValidatorTest extends ConstraintValidatorTestCase { /** * @var AddressFormatConstraint @@ -23,7 +23,7 @@ class AddressFormatConstraintValidatorTest extends ConstraintValidatorTestCase /** * {@inheritdoc} */ - public function setUp() + protected function setUp() { $this->constraint = new AddressFormatConstraint(); diff --git a/tests/Validator/Constraints/CountryConstraintValidatorTest.php b/tests/Validator/Constraints/CountryConstraintValidatorTest.php index 582637de..6f0efc2e 100644 --- a/tests/Validator/Constraints/CountryConstraintValidatorTest.php +++ b/tests/Validator/Constraints/CountryConstraintValidatorTest.php @@ -9,7 +9,7 @@ /** * @coversDefaultClass \CommerceGuys\Addressing\Validator\Constraints\CountryConstraintValidator */ -class CountryConstraintValidatorTest extends ConstraintValidatorTestCase +final class CountryConstraintValidatorTest extends ConstraintValidatorTestCase { /** * @var CountryConstraint @@ -19,7 +19,7 @@ class CountryConstraintValidatorTest extends ConstraintValidatorTestCase /** * {@inheritdoc} */ - public function setUp() + protected function setUp() { $this->constraint = new CountryConstraint(); diff --git a/tests/Zone/ZoneTerritoryTest.php b/tests/Zone/ZoneTerritoryTest.php index 8c05d65b..b0da4690 100644 --- a/tests/Zone/ZoneTerritoryTest.php +++ b/tests/Zone/ZoneTerritoryTest.php @@ -4,11 +4,12 @@ use CommerceGuys\Addressing\Address; use CommerceGuys\Addressing\Zone\ZoneTerritory; +use PHPUnit\Framework\TestCase; /** * @coversDefaultClass \CommerceGuys\Addressing\Zone\ZoneTerritory */ -class ZoneTerritoryTest extends \PHPUnit_Framework_TestCase +final class ZoneTerritoryTest extends TestCase { /** * @covers ::__construct diff --git a/tests/Zone/ZoneTest.php b/tests/Zone/ZoneTest.php index 2386425a..ff27bd78 100644 --- a/tests/Zone/ZoneTest.php +++ b/tests/Zone/ZoneTest.php @@ -4,11 +4,12 @@ use CommerceGuys\Addressing\Address; use CommerceGuys\Addressing\Zone\Zone; +use PHPUnit\Framework\TestCase; /** * @coversDefaultClass \CommerceGuys\Addressing\Zone\Zone */ -class ZoneTest extends \PHPUnit_Framework_TestCase +final class ZoneTest extends TestCase { /** * @covers ::__construct