mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-06 23:33:13 +08:00
Move logic to determine if a new key has a duplicated name to the APiKeyService
This commit is contained in:
@@ -71,21 +71,4 @@ class GenerateKeyCommandTest extends TestCase
|
||||
|
||||
self::assertEquals(ExitCode::EXIT_SUCCESS, $exitCode);
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function warningIsPrintedIfProvidedNameAlreadyExists(): void
|
||||
{
|
||||
$name = 'The API key';
|
||||
|
||||
$this->apiKeyService->expects($this->never())->method('create');
|
||||
$this->apiKeyService->expects($this->once())->method('existsWithName')->with($name)->willReturn(true);
|
||||
|
||||
$exitCode = $this->commandTester->execute([
|
||||
'--name' => $name,
|
||||
]);
|
||||
$output = $this->commandTester->getDisplay();
|
||||
|
||||
self::assertEquals(ExitCode::EXIT_WARNING, $exitCode);
|
||||
self::assertStringContainsString('An API key with name "The API key" already exists.', $output);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user