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 casepull/11485/head
parent
c45b403967
commit
7528c86e58
|
@ -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"
|
"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)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue