Skip to content

Commit 9338741

Browse files
committed
Fix travis build by allow composer2 file structue
1 parent d8e9b93 commit 9338741

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

tests/ReaderTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,12 @@ public function testSymfonyYamlBugHunt()
9696
{
9797
// skip test on symfony/yaml 5.0 due to bug https://github.com/symfony/symfony/issues/34805
9898
$installed = json_decode(file_get_contents(__DIR__ . '/../vendor/composer/installed.json'), true);
99+
// Check for composer 2.0 structure
100+
if (array_key_exists('packages', $installed)) {
101+
$installed = $installed['packages'];
102+
}
99103
foreach($installed as $pkg) {
100-
if ($pkg['name'] === 'symfony/yaml' && strncmp($pkg['version_normalized'], '5.0', 3) === 0) {
104+
if ($pkg['name'] === 'symfony/yaml' && version_compare($pkg['version'], 'v4.4', '>=')) {
101105
$this->markTestSkipped(
102106
'This test is incompatible with symfony/yaml 4.4 and 5.0, see symfony bug https://github.com/symfony/symfony/issues/34805'
103107
);

tests/spec/OpenApiTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,12 @@ public function testSpecs($openApiFile)
186186
// skip test on symfony/yaml 5.0 due to bug https://github.com/symfony/symfony/issues/34805
187187
if ($openApiFile === 'oai/openapi-specification/examples/v3.0/uspto.yaml') {
188188
$installed = json_decode(file_get_contents(__DIR__ . '/../../vendor/composer/installed.json'), true);
189+
// Check for composer 2.0 structure
190+
if (array_key_exists('packages', $installed)) {
191+
$installed = $installed['packages'];
192+
}
189193
foreach ($installed as $pkg) {
190-
if ($pkg['name'] === 'symfony/yaml' && strncmp($pkg['version_normalized'], '5.0', 3) === 0) {
194+
if ($pkg['name'] === 'symfony/yaml' && version_compare($pkg['version'], 'v4.4', '>=')) {
191195
$this->markTestSkipped(
192196
'This test is incompatible with symfony/yaml 4.4 and 5.0, see symfony bug https://github.com/symfony/symfony/issues/34805'
193197
);

0 commit comments

Comments
 (0)