From 29e913a345932c7dbe2be531377b58b667ae374f Mon Sep 17 00:00:00 2001 From: Bob Fanger Date: Sun, 3 Feb 2019 21:24:23 +0100 Subject: [PATCH] Upgraded to PHPUnit 8 (and dropped support for outdated php versions) --- .gitignore | 3 ++- .travis.yml | 6 ++---- composer.json | 4 ++-- tests/AnalyserTest.php | 2 +- tests/CommandlineInterfaceTest.php | 2 +- tests/ItemsTest.php | 2 +- tests/OpenApiTestCase.php | 4 ++-- tests/SerializerTest.php | 4 ++-- 8 files changed, 13 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index f8c662c3d..1267eb82b 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ !/bin/openapi /openapi.json /openapi.yaml -/docs/.vuepress/dist \ No newline at end of file +/docs/.vuepress/dist +.phpunit.result.cache \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 2b64e12bd..de44d5dbb 100755 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,8 @@ language: php php: - - 7.0 - - 7.1 - 7.2 + - 7.3 sudo: false @@ -12,9 +11,8 @@ env: - PHPUNIT=1 matrix: - include: - - php: 7.2 + - php: 7.3 env: PHPCS=1 PHPUNIT=0 before_script: diff --git a/composer.json b/composer.json index 9895f5fdb..d90fa1762 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,7 @@ "bin-dir": "bin" }, "require": { - "php": ">=7.0", + "php": ">=7.2", "doctrine/annotations": "*", "symfony/finder": ">=2.2", "symfony/yaml": ">=3.3" @@ -45,7 +45,7 @@ "require-dev": { "zendframework/zend-form": "<2.8", "squizlabs/php_codesniffer": ">=3.3", - "phpunit/phpunit": ">=6.3" + "phpunit/phpunit": ">=8" }, "autoload-dev": { "psr-4": { diff --git a/tests/AnalyserTest.php b/tests/AnalyserTest.php index 9c339cbea..9f64f6a38 100644 --- a/tests/AnalyserTest.php +++ b/tests/AnalyserTest.php @@ -11,7 +11,7 @@ class AnalyserTest extends OpenApiTestCase public function testParseContents() { $annotations = $this->parseComment('@OA\Parameter(description="This is my parameter")'); - $this->assertInternalType('array', $annotations); + $this->assertIsArray($annotations); $parameter = $annotations[0]; $this->assertInstanceOf('OpenApi\Annotations\Parameter', $parameter); $this->assertSame('This is my parameter', $parameter->description); diff --git a/tests/CommandlineInterfaceTest.php b/tests/CommandlineInterfaceTest.php index 9f9685491..35043dc81 100644 --- a/tests/CommandlineInterfaceTest.php +++ b/tests/CommandlineInterfaceTest.php @@ -8,7 +8,7 @@ class CommandlineInterfaceTest extends OpenApiTestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); } diff --git a/tests/ItemsTest.php b/tests/ItemsTest.php index b4241401e..12882fb6d 100644 --- a/tests/ItemsTest.php +++ b/tests/ItemsTest.php @@ -39,7 +39,7 @@ public function testRefDefinitionInProperty() $analysis->process(); $this->assertCount(2, $analysis->openapi->components->schemas); $this->assertEquals('UsingVar', $analysis->openapi->components->schemas[0]->schema); - $this->assertInternalType('array', $analysis->openapi->components->schemas[0]->properties); + $this->assertIsArray($analysis->openapi->components->schemas[0]->properties); $this->assertCount(2, $analysis->openapi->components->schemas[0]->properties); $this->assertEquals('name', $analysis->openapi->components->schemas[0]->properties[0]->property); $this->assertEquals('createdAt', $analysis->openapi->components->schemas[0]->properties[1]->property); diff --git a/tests/OpenApiTestCase.php b/tests/OpenApiTestCase.php index c8735e9f8..617ca31be 100644 --- a/tests/OpenApiTestCase.php +++ b/tests/OpenApiTestCase.php @@ -87,7 +87,7 @@ public function assertOpenApiLogEntryStartsWith($entryPrefix, $message = '') }; } - protected function setUp() + protected function setUp(): void { $this->expectedLogMessages = []; $this->originalLogger = Logger::getInstance()->log; @@ -110,7 +110,7 @@ protected function setUp() parent::setUp(); } - protected function tearDown() + protected function tearDown(): void { $this->assertCount($this->countExceptions, $this->expectedLogMessages, count($this->expectedLogMessages).' OpenApi\Logger messages were not triggered'); Logger::getInstance()->log = $this->originalLogger; diff --git a/tests/SerializerTest.php b/tests/SerializerTest.php index 04e542ec5..06262157c 100644 --- a/tests/SerializerTest.php +++ b/tests/SerializerTest.php @@ -180,9 +180,9 @@ public function testDeserializeAllOfProperty() foreach ($annotation->components->schemas as $schemaObject) { $this->assertObjectHasAttribute('allOf', $schemaObject); $this->assertNotSame($schemaObject->allOf, UNDEFINED); - $this->assertInternalType('array', $schemaObject->allOf); + $this->assertIsArray($schemaObject->allOf); $allOfItem = current($schemaObject->allOf); - $this->assertInternalType('object', $allOfItem); + $this->assertIsObject($allOfItem); $this->assertInstanceOf(Annotations\Schema::class, $allOfItem); $this->assertObjectHasAttribute('ref', $allOfItem); $this->assertNotSame($allOfItem->ref, UNDEFINED);