Roll back change to allow creating API keys with custom value

This commit is contained in:
Alejandro Celaya
2023-09-21 08:58:05 +02:00
parent f6b1cc7556
commit 6db46b50e9
8 changed files with 38 additions and 62 deletions

View File

@@ -1,31 +0,0 @@
<?php
declare(strict_types=1);
namespace ShlinkioCliTest\Shlink\CLI\Command;
use PHPUnit\Framework\Attributes\Test;
use Shlinkio\Shlink\CLI\Command\Api\CreateKeyCommand;
use Shlinkio\Shlink\CLI\Util\ExitCode;
use Shlinkio\Shlink\TestUtils\CliTest\CliTestCase;
class CreateApiKeyTest extends CliTestCase
{
#[Test]
public function outputIsCorrect(): void
{
[$output, $exitCode] = $this->exec([CreateKeyCommand::NAME]);
self::assertStringContainsString('[OK] Generated API key', $output);
self::assertEquals(ExitCode::EXIT_SUCCESS, $exitCode);
}
#[Test]
public function allowsCustomKeyToBeProvided(): void
{
[$output, $exitCode] = $this->exec([CreateKeyCommand::NAME, 'custom_api_key']);
self::assertStringContainsString('[OK] Generated API key: "custom_api_key"', $output);
self::assertEquals(ExitCode::EXIT_SUCCESS, $exitCode);
}
}

View File

@@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
namespace ShlinkioCliTest\Shlink\CLI\Command;
use PHPUnit\Framework\Attributes\Test;
use Shlinkio\Shlink\CLI\Command\Api\GenerateKeyCommand;
use Shlinkio\Shlink\CLI\Util\ExitCode;
use Shlinkio\Shlink\TestUtils\CliTest\CliTestCase;
class GenerateApiKeyTest extends CliTestCase
{
#[Test]
public function outputIsCorrect(): void
{
[$output, $exitCode] = $this->exec([GenerateKeyCommand::NAME]);
self::assertStringContainsString('[OK] Generated API key', $output);
self::assertEquals(ExitCode::EXIT_SUCCESS, $exitCode);
}
}