mirror of
https://github.com/composer/composer
synced 2025-05-10 17:12:51 +00:00
Add a new test to confirm that show --direct <name> works with direct dependents/dev-dependents
This commit is contained in:
parent
2027d4975a
commit
54870a78c4
1 changed files with 35 additions and 1 deletions
|
@ -299,23 +299,57 @@ Transitive dependencies not required in composer.json:
|
||||||
vendor/package 1.1.0 <highlight>! 1.2.0</highlight>", trim($appTester->getDisplay(true)));
|
vendor/package 1.1.0 <highlight>! 1.2.0</highlight>", trim($appTester->getDisplay(true)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testShowDirectWithNameOnlyShowsDirectDependents(): void
|
public function testShowDirectWithNameDoesNotShowTransientDependencies(): void
|
||||||
{
|
{
|
||||||
self::expectException(InvalidArgumentException::class);
|
self::expectException(InvalidArgumentException::class);
|
||||||
self::expectExceptionMessage('Package "vendor/package" is installed but not a direct dependent of the root package.');
|
self::expectExceptionMessage('Package "vendor/package" is installed but not a direct dependent of the root package.');
|
||||||
|
|
||||||
$this->initTempComposer([
|
$this->initTempComposer([
|
||||||
'repositories' => [],
|
'repositories' => [],
|
||||||
|
'require' => [
|
||||||
|
'direct/dependent' => '*',
|
||||||
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->createInstalledJson([
|
$this->createInstalledJson([
|
||||||
|
$direct = self::getPackage('direct/dependent', '1.0.0'),
|
||||||
self::getPackage('vendor/package', '1.0.0'),
|
self::getPackage('vendor/package', '1.0.0'),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$this->configureLinks($direct, ['require' => ['vendor/package' => '*']]);
|
||||||
|
|
||||||
$appTester = $this->getApplicationTester();
|
$appTester = $this->getApplicationTester();
|
||||||
$appTester->run(['command' => 'show', '--direct' => true, 'package' => 'vendor/package']);
|
$appTester->run(['command' => 'show', '--direct' => true, 'package' => 'vendor/package']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testShowDirectWithNameOnlyShowsDirectDependents(): void
|
||||||
|
{
|
||||||
|
$this->initTempComposer([
|
||||||
|
'repositories' => [],
|
||||||
|
'require' => [
|
||||||
|
'direct/dependent' => '*',
|
||||||
|
],
|
||||||
|
'require-dev' => [
|
||||||
|
'direct/dependent2' => '*',
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->createInstalledJson([
|
||||||
|
self::getPackage('direct/dependent', '1.0.0'),
|
||||||
|
self::getPackage('direct/dependent2', '1.0.0'),
|
||||||
|
]);
|
||||||
|
|
||||||
|
$appTester = $this->getApplicationTester();
|
||||||
|
$appTester->run(['command' => 'show', '--direct' => true, 'package' => 'direct/dependent']);
|
||||||
|
$appTester->assertCommandIsSuccessful();
|
||||||
|
self::assertStringContainsString('name : direct/dependent' . "\n", $appTester->getDisplay(true));
|
||||||
|
|
||||||
|
$appTester = $this->getApplicationTester();
|
||||||
|
$appTester->run(['command' => 'show', '--direct' => true, 'package' => 'direct/dependent2']);
|
||||||
|
$appTester->assertCommandIsSuccessful();
|
||||||
|
self::assertStringContainsString('name : direct/dependent2' . "\n", $appTester->getDisplay(true));
|
||||||
|
}
|
||||||
|
|
||||||
public function testShowPlatformOnlyShowsPlatformPackages(): void
|
public function testShowPlatformOnlyShowsPlatformPackages(): void
|
||||||
{
|
{
|
||||||
$this->initTempComposer([
|
$this->initTempComposer([
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue