1
0
Fork 0

Test json format on failed platform reqs (#11477)

* test: Adds case for json format arg

* test: A failed platofrm requirement

* chore: style fix

* chore: removes redundant test case
pull/11485/head
Alex Theobold 2023-05-28 14:15:21 +01:00 committed by GitHub
parent c45b403967
commit 7528c86e58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 51 additions and 0 deletions

View File

@ -88,4 +88,55 @@ ext-foobar 2.3.4 success'
"Checking platform requirements using the lock file\next-barbaz 2.3.4.5 success \next-foobar 2.3.4 success"
];
}
public function testFailedPlatformRequirement(): void
{
$this->initTempComposer([
'require' => [
'ext-foobar' => '^0.3'
],
'require-dev' => [
'ext-barbaz' => '^2.3'
]
]);
$packages = [
self::getPackage('ext-foobar', '2.3.4'),
];
$devPackages = [
self::getPackage('ext-barbaz', '2.3.4.5')
];
$this->createInstalledJson($packages, $devPackages);
$this->createComposerLock($packages, $devPackages);
$appTester = $this->getApplicationTester();
$appTester->run(['command' => 'check-platform-reqs', '--format' => 'json']);
$expected = 'Checking platform requirements for packages in the vendor dir
[
{
"name": "ext-barbaz",
"version": "2.3.4.5",
"status": "success",
"failed_requirement": null,
"provider": null
},
{
"name": "ext-foobar",
"version": "2.3.4",
"status": "failed",
"failed_requirement": {
"source": "__root__",
"type": "requires",
"target": "ext-foobar",
"constraint": "^0.3"
},
"provider": null
}
]';
$this->assertSame(trim($expected), trim($appTester->getDisplay(true)));
}
}