@@ -423,8 +423,7 @@ public function testTransitiveReferenceOverTwoFiles()
423
423
424
424
$ yaml = \cebe \openapi \Writer::writeToYaml ($ openapi );
425
425
426
- $ this ->assertEquals (
427
- <<<YAML
426
+ $ expected = <<<YAML
428
427
openapi: 3.0.0
429
428
info:
430
429
title: 'Ref Example'
@@ -441,8 +440,14 @@ public function testTransitiveReferenceOverTwoFiles()
441
440
'200':
442
441
description: 'return a cat'
443
442
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
+ }
446
451
}
447
452
448
453
public function testResolveRelativePathInline ()
@@ -451,8 +456,7 @@ public function testResolveRelativePathInline()
451
456
452
457
$ yaml = \cebe \openapi \Writer::writeToYaml ($ openapi );
453
458
454
- $ this ->assertEquals (
455
- <<<YAML
459
+ $ expected = <<<YAML
456
460
openapi: 3.0.3
457
461
info:
458
462
title: 'Link Example'
@@ -487,8 +491,14 @@ public function testResolveRelativePathInline()
487
491
\$ref: '#/components/schemas/Pet'
488
492
description: 'A Cat'
489
493
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
+ }
492
502
}
493
503
494
504
public function testResolveRelativePathAll ()
@@ -497,8 +507,7 @@ public function testResolveRelativePathAll()
497
507
498
508
$ yaml = \cebe \openapi \Writer::writeToYaml ($ openapi );
499
509
500
- $ this ->assertEquals (
501
- <<<YAML
510
+ $ expected = <<<YAML
502
511
openapi: 3.0.3
503
512
info:
504
513
title: 'Link Example'
@@ -550,8 +559,14 @@ public function testResolveRelativePathAll()
550
559
description: 'A Pet'
551
560
description: 'A Cat'
552
561
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
+ }
555
570
}
556
571
557
572
}
0 commit comments