From 62eb3d22e9666746bc29ef685a71fb58f8b1cbd9 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Wed, 4 Dec 2019 09:43:30 +0100 Subject: [PATCH 1/3] add test for symfony yaml --- .travis.yml | 26 ++++++++++++++++++-------- tests/ReaderTest.php | 32 +++++++++++++++++++++++++++++++- 2 files changed, 49 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index c98b9be0..c1d1fa08 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,19 +4,29 @@ matrix: include: # linux tests - php: '7.1' - env: YAML=3.0 + env: YAML=^3.0 - php: '7.1' - env: YAML=4.0 + env: YAML=^4.0 - php: '7.2' - env: YAML=3.0 + env: YAML=^3.0 - php: '7.2' - env: YAML=4.0 + env: YAML=^4.0 - php: '7.3' - env: YAML=3.0 + env: YAML=^3.0 - php: '7.3' - env: YAML=4.0 + env: YAML=^4.0 + - php: '7.3' + env: YAML=~4.1.0 + - php: '7.3' + env: YAML=~4.2.0 + - php: '7.3' + env: YAML=~4.3.0 + - php: '7.3' + env: YAML=~4.4.0 + - php: '7.3' + env: YAML=^5.0 - php: nightly - env: YAML=4.0 + env: YAML=^4.0 # windows tests # https://travis-ci.community/t/where-to-contribute-php-support-for-windows/304 - os: windows @@ -43,7 +53,7 @@ matrix: install: - make install - - composer require symfony/yaml:"^${YAML}" --prefer-dist --no-interaction + - composer require symfony/yaml:"${YAML}" --prefer-dist --no-interaction script: - make lint - make test diff --git a/tests/ReaderTest.php b/tests/ReaderTest.php index 50b19f33..69b4a4d0 100644 --- a/tests/ReaderTest.php +++ b/tests/ReaderTest.php @@ -89,7 +89,37 @@ private function assertApiContent(\cebe\openapi\spec\OpenApi $openapi) $this->assertEquals("1.0.0", $openapi->info->version); } - + public function testSymfonyYamlBugHunt() + { + $openApiFile = __DIR__ . '/../vendor/oai/openapi-specification/examples/v3.0/uspto.yaml'; + $openapi = \cebe\openapi\Reader::readFromYamlFile($openApiFile); + + $inlineYamlExample = $openapi->paths['/']->get->responses['200']->content['application/json']->example; + $this->assertInternalType('array', $inlineYamlExample); + $expectedArray = json_decode(<<assertEquals($expectedArray, $inlineYamlExample); + } + + // TODO test invalid JSON // TODO test invalid YAML } From b49e67ecff2546b1fcbdb033f1fee85c3f3532d7 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Wed, 4 Dec 2019 10:12:19 +0100 Subject: [PATCH 2/3] remove platform restriction from composer.json --- composer.json | 5 ----- 1 file changed, 5 deletions(-) diff --git a/composer.json b/composer.json index 566a9528..a37ea07d 100644 --- a/composer.json +++ b/composer.json @@ -38,11 +38,6 @@ "cebe\\openapi\\": "src/" } }, - "config": { - "platform": { - "php": "7.1.3" - } - }, "extra": { "branch-alias": { "dev-master": "1.0.x-dev" From 185ad6a7570353e73c6866a85951bd7f5c621141 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Wed, 4 Dec 2019 10:17:53 +0100 Subject: [PATCH 3/3] php-cs-fixer version bump --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index a37ea07d..933780b8 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ }, "require-dev": { "cebe/indent": "*", - "friendsofphp/php-cs-fixer": "~2.13.1", + "friendsofphp/php-cs-fixer": "~2.16.1", "phpunit/phpunit": "^6.5", "oai/openapi-specification": "3.0.2",