@@ -423,8 +423,7 @@ public function testTransitiveReferenceOverTwoFiles()
423423
424424 $ yaml = \cebe \openapi \Writer::writeToYaml ($ openapi );
425425
426- $ this ->assertEquals (
427- <<<YAML
426+ $ expected = <<<YAML
428427openapi: 3.0.0
429428info:
430429 title: 'Ref Example'
@@ -441,8 +440,14 @@ public function testTransitiveReferenceOverTwoFiles()
441440 '200':
442441 description: 'return a cat'
443442
444- YAML
445- , $ yaml , $ yaml );
443+ YAML ;
444+ if (PHP_VERSION_ID < 70200 ) {
445+ // PHP <7.2 returns numeric properties in yaml maps as integer, since 7.2 these are string
446+ // probably related to https://www.php.net/manual/de/migration72.incompatible.php#migration72.incompatible.object-array-casts
447+ $ this ->assertEquals (str_replace ("'200': " , "200: " , $ expected ), $ yaml , $ yaml );
448+ } else {
449+ $ this ->assertEquals ($ expected , $ yaml , $ yaml );
450+ }
446451 }
447452
448453 public function testResolveRelativePathInline ()
@@ -451,8 +456,7 @@ public function testResolveRelativePathInline()
451456
452457 $ yaml = \cebe \openapi \Writer::writeToYaml ($ openapi );
453458
454- $ this ->assertEquals (
455- <<<YAML
459+ $ expected = <<<YAML
456460openapi: 3.0.3
457461info:
458462 title: 'Link Example'
@@ -487,8 +491,14 @@ public function testResolveRelativePathInline()
487491 \$ref: '#/components/schemas/Pet'
488492 description: 'A Cat'
489493
490- YAML
491- , $ yaml , $ yaml );
494+ YAML ;
495+ if (PHP_VERSION_ID < 70200 ) {
496+ // PHP <7.2 returns numeric properties in yaml maps as integer, since 7.2 these are string
497+ // probably related to https://www.php.net/manual/de/migration72.incompatible.php#migration72.incompatible.object-array-casts
498+ $ this ->assertEquals (str_replace ("'200': " , "200: " , $ expected ), $ yaml , $ yaml );
499+ } else {
500+ $ this ->assertEquals ($ expected , $ yaml , $ yaml );
501+ }
492502 }
493503
494504 public function testResolveRelativePathAll ()
@@ -497,8 +507,7 @@ public function testResolveRelativePathAll()
497507
498508 $ yaml = \cebe \openapi \Writer::writeToYaml ($ openapi );
499509
500- $ this ->assertEquals (
501- <<<YAML
510+ $ expected = <<<YAML
502511openapi: 3.0.3
503512info:
504513 title: 'Link Example'
@@ -550,8 +559,14 @@ public function testResolveRelativePathAll()
550559 description: 'A Pet'
551560 description: 'A Cat'
552561
553- YAML
554- , $ yaml , $ yaml );
562+ YAML ;
563+ if (PHP_VERSION_ID < 70200 ) {
564+ // PHP <7.2 returns numeric properties in yaml maps as integer, since 7.2 these are string
565+ // probably related to https://www.php.net/manual/de/migration72.incompatible.php#migration72.incompatible.object-array-casts
566+ $ this ->assertEquals (str_replace ("'200': " , "200: " , $ expected ), $ yaml , $ yaml );
567+ } else {
568+ $ this ->assertEquals ($ expected , $ yaml , $ yaml );
569+ }
555570 }
556571
557572}
0 commit comments