Skip to content

Commit a889cde

Browse files
committed
fixes
1 parent 4827afc commit a889cde

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

src/Maker/MakeRouteProvider.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ public function configureDependencies(DependencyBuilder $dependencies): void
6161
*/
6262
public function generate(InputInterface $input, ConsoleStyle $io, Generator $generator): void
6363
{
64-
$name = (string) $input->getArgument('name');
64+
/** @var string $name */
65+
$name = $input->getArgument('name');
6566

6667
if (false === $entity = $this->inputEntity($io)) {
6768
return;
@@ -102,7 +103,9 @@ private function inputEntity(ConsoleStyle $io): string|false
102103
{
103104
$q = new Question('What entity is the purge route provider for?');
104105
$q->setTrimmable(true);
105-
$purgeEntity = (string) $io->askQuestion($q);
106+
107+
/** @var string $purgeEntity */
108+
$purgeEntity = $io->askQuestion($q);
106109

107110
$entities = $this->getEntityCollection();
108111
$entities = array_filter(

tests/Maker/MakeRouteProviderTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,13 @@ public function testGenerateRouteProvider(array $input, string $expected): void
7373
actual: __DIR__."/../Functional/TestApplication/Generated/Purgatory/RouteProvider/$expected.php",
7474
);
7575
}
76+
77+
public function testInvalidEntityInput(): void
78+
{
79+
$input = ['foo', 'BlogPost'];
80+
$this->command->setInputs([implode(\PHP_EOL, $input).\PHP_EOL]);
81+
$this->command->execute([], ['interactive' => true]);
82+
83+
self::assertStringContainsString('[ERROR] No entities found', $this->command->getDisplay());
84+
}
7685
}

0 commit comments

Comments
 (0)