From 14d822ab38453d46705928b17ba1ef4f30409c5e Mon Sep 17 00:00:00 2001 From: peter279k Date: Tue, 12 Nov 2019 18:40:23 +0800 Subject: [PATCH] Test enhancement --- .php_cs | 1 + .travis.yml | 2 +- composer.json | 2 +- tests/GeoIp2/Test/Database/ReaderTest.php | 3 ++- tests/GeoIp2/Test/Model/CountryTest.php | 5 +++-- tests/GeoIp2/Test/Model/InsightsTest.php | 3 ++- tests/GeoIp2/Test/Model/NameTest.php | 3 ++- tests/GeoIp2/Test/UtilTest.php | 3 ++- tests/GeoIp2/Test/WebService/ClientTest.php | 3 ++- 9 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.php_cs b/.php_cs index 7d178488..3294366d 100644 --- a/.php_cs +++ b/.php_cs @@ -24,6 +24,7 @@ return PhpCsFixer\Config::create() 'phpdoc_no_alias_tag' => false, 'phpdoc_order' => true, 'semicolon_after_instruction' => true, + 'single_line_throw' => false, 'strict_comparison' => true, 'strict_param' => true, 'yoda_style' => false, diff --git a/.travis.yml b/.travis.yml index b931dc25..85bdf1c0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,7 +23,7 @@ matrix: - php: 'nightly' before_install: - - composer install --dev -n --prefer-source + - composer install -n --prefer-source - phpenv rehash - "if [[ $RUN_SNYK && $SNYK_TOKEN ]]; then sudo apt-get install -y nodejs; npm install -g snyk; fi" diff --git a/composer.json b/composer.json index 068cfcef..48707ad1 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ }, "require-dev": { "friendsofphp/php-cs-fixer": "2.*", - "phpunit/phpunit": "4.* || 5.*", + "phpunit/phpunit": "^4.8.36 || 5.*", "squizlabs/php_codesniffer": "3.*" }, "autoload": { diff --git a/tests/GeoIp2/Test/Database/ReaderTest.php b/tests/GeoIp2/Test/Database/ReaderTest.php index 02fadce0..55be5730 100644 --- a/tests/GeoIp2/Test/Database/ReaderTest.php +++ b/tests/GeoIp2/Test/Database/ReaderTest.php @@ -3,11 +3,12 @@ namespace GeoIp2\Test\Database; use GeoIp2\Database\Reader; +use PHPUnit\Framework\TestCase; /** * @coversNothing */ -class ReaderTest extends \PHPUnit_Framework_TestCase +class ReaderTest extends TestCase { public function databaseTypes() { diff --git a/tests/GeoIp2/Test/Model/CountryTest.php b/tests/GeoIp2/Test/Model/CountryTest.php index d6d3b2cc..d9530ade 100644 --- a/tests/GeoIp2/Test/Model/CountryTest.php +++ b/tests/GeoIp2/Test/Model/CountryTest.php @@ -3,11 +3,12 @@ namespace GeoIp2\Test\Model; use GeoIp2\Model\Country; +use PHPUnit\Framework\TestCase; /** * @coversNothing */ -class CountryTest extends \PHPUnit_Framework_TestCase +class CountryTest extends TestCase { private $raw = [ 'continent' => [ @@ -34,7 +35,7 @@ class CountryTest extends \PHPUnit_Framework_TestCase private $model; - public function setUp() + protected function setUp() { $this->model = new Country($this->raw, ['en']); } diff --git a/tests/GeoIp2/Test/Model/InsightsTest.php b/tests/GeoIp2/Test/Model/InsightsTest.php index 884f1882..d759d163 100644 --- a/tests/GeoIp2/Test/Model/InsightsTest.php +++ b/tests/GeoIp2/Test/Model/InsightsTest.php @@ -3,11 +3,12 @@ namespace GeoIp2\Test\Model; use GeoIp2\Model\Insights; +use PHPUnit\Framework\TestCase; /** * @coversNothing */ -class InsightsTest extends \PHPUnit_Framework_TestCase +class InsightsTest extends TestCase { public function testFull() { diff --git a/tests/GeoIp2/Test/Model/NameTest.php b/tests/GeoIp2/Test/Model/NameTest.php index f7f5363a..34448259 100644 --- a/tests/GeoIp2/Test/Model/NameTest.php +++ b/tests/GeoIp2/Test/Model/NameTest.php @@ -3,11 +3,12 @@ namespace GeoIp2\Test\Model; use GeoIp2\Model\Country; +use PHPUnit\Framework\TestCase; /** * @coversNothing */ -class NameTest extends \PHPUnit_Framework_TestCase +class NameTest extends TestCase { public $raw = [ 'continent' => [ diff --git a/tests/GeoIp2/Test/UtilTest.php b/tests/GeoIp2/Test/UtilTest.php index 81c15885..959063f7 100644 --- a/tests/GeoIp2/Test/UtilTest.php +++ b/tests/GeoIp2/Test/UtilTest.php @@ -3,11 +3,12 @@ namespace GeoIp2\Test; use GeoIp2\Util; +use PHPUnit\Framework\TestCase; /** * @coversNothing */ -class UtilTest extends \PHPUnit_Framework_TestCase +class UtilTest extends TestCase { public function testCidr() { diff --git a/tests/GeoIp2/Test/WebService/ClientTest.php b/tests/GeoIp2/Test/WebService/ClientTest.php index 73e90cdf..cf472afb 100644 --- a/tests/GeoIp2/Test/WebService/ClientTest.php +++ b/tests/GeoIp2/Test/WebService/ClientTest.php @@ -4,11 +4,12 @@ use Composer\CaBundle\CaBundle; use MaxMind\WebService\Client as WsClient; +use PHPUnit\Framework\TestCase; /** * @coversNothing */ -class ClientTest extends \PHPUnit_Framework_TestCase +class ClientTest extends TestCase { private $country = [ 'continent' => [