Skip to content

Commit

Permalink
Upgraded to PHPUnit 8 (and dropped support for outdated php versions)
Browse files Browse the repository at this point in the history
  • Loading branch information
bfanger committed Feb 3, 2019
1 parent ad70f2a commit 29e913a
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 14 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
!/bin/openapi
/openapi.json
/openapi.yaml
/docs/.vuepress/dist
/docs/.vuepress/dist
.phpunit.result.cache
6 changes: 2 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
language: php

php:
- 7.0
- 7.1
- 7.2
- 7.3

sudo: false

Expand All @@ -12,9 +11,8 @@ env:
- PHPUNIT=1

matrix:

include:
- php: 7.2
- php: 7.3
env: PHPCS=1 PHPUNIT=0

before_script:
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"bin-dir": "bin"
},
"require": {
"php": ">=7.0",
"php": ">=7.2",
"doctrine/annotations": "*",
"symfony/finder": ">=2.2",
"symfony/yaml": ">=3.3"
Expand All @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion tests/AnalyserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion tests/CommandlineInterfaceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class CommandlineInterfaceTest extends OpenApiTestCase
{
protected function setUp()
protected function setUp(): void
{
parent::setUp();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/ItemsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions tests/OpenApiTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function assertOpenApiLogEntryStartsWith($entryPrefix, $message = '')
};
}

protected function setUp()
protected function setUp(): void
{
$this->expectedLogMessages = [];
$this->originalLogger = Logger::getInstance()->log;
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions tests/SerializerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 29e913a

Please sign in to comment.