Skip to content

Commit 55f75ee

Browse files
committed
test: guard composer provider against alias-only command entries
1 parent 3b703e4 commit 55f75ee

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

tests/Composer/Capability/DevToolsCommandProviderTest.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,30 @@ public function getCommandsWillReturnComposerProxyCommandsForRegisteredSymfonyCo
104104
self::assertInstanceOf(ProxyCommand::class, $command);
105105
self::assertSame('agents', $command->getName());
106106
}
107+
108+
/**
109+
* @return void
110+
*/
111+
#[Test]
112+
public function getCommandsWillIgnoreAliasEntriesFromApplicationAllRegistry(): void
113+
{
114+
$symfonyCommand = new FixtureWithoutAsCommand('reports:tests');
115+
$symfonyCommand->setAliases(['tests']);
116+
$symfonyCommand->setDescription('Runs PHPUnit tests.');
117+
$symfonyCommand->setHelp('');
118+
$symfonyCommand->setHidden(false);
119+
120+
$this->devTools->all()
121+
->willReturn([
122+
'reports:tests' => $symfonyCommand,
123+
'tests' => $symfonyCommand,
124+
])
125+
->shouldBeCalledOnce();
126+
127+
$commands = $this->commandProvider->getCommands();
128+
129+
self::assertCount(1, $commands);
130+
self::assertInstanceOf(ProxyCommand::class, $commands[0]);
131+
self::assertSame('reports:tests', $commands[0]->getName());
132+
}
107133
}

0 commit comments

Comments
 (0)