mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-06 23:33:13 +08:00
Roll back change to allow creating API keys with custom value
This commit is contained in:
@@ -9,7 +9,7 @@ use PHPUnit\Framework\Attributes\Test;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Shlinkio\Shlink\CLI\ApiKey\RoleResolverInterface;
|
||||
use Shlinkio\Shlink\CLI\Command\Api\CreateKeyCommand;
|
||||
use Shlinkio\Shlink\CLI\Command\Api\GenerateKeyCommand;
|
||||
use Shlinkio\Shlink\Rest\ApiKey\Model\ApiKeyMeta;
|
||||
use Shlinkio\Shlink\Rest\Entity\ApiKey;
|
||||
use Shlinkio\Shlink\Rest\Service\ApiKeyServiceInterface;
|
||||
@@ -17,7 +17,7 @@ use ShlinkioTest\Shlink\CLI\CliTestUtilsTrait;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Tester\CommandTester;
|
||||
|
||||
class CreateKeyCommandTest extends TestCase
|
||||
class GenerateKeyCommandTest extends TestCase
|
||||
{
|
||||
use CliTestUtilsTrait;
|
||||
|
||||
@@ -30,7 +30,7 @@ class CreateKeyCommandTest extends TestCase
|
||||
$roleResolver = $this->createMock(RoleResolverInterface::class);
|
||||
$roleResolver->method('determineRoles')->with($this->isInstanceOf(InputInterface::class))->willReturn([]);
|
||||
|
||||
$command = new CreateKeyCommand($this->apiKeyService, $roleResolver);
|
||||
$command = new GenerateKeyCommand($this->apiKeyService, $roleResolver);
|
||||
$this->commandTester = $this->testerForCommand($command);
|
||||
}
|
||||
|
||||
@@ -70,14 +70,4 @@ class CreateKeyCommandTest extends TestCase
|
||||
'--name' => 'Alice',
|
||||
]);
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function createsCustomApiKeyWhenProvided(): void
|
||||
{
|
||||
$this->apiKeyService->expects($this->once())->method('create')->with(
|
||||
$this->callback(fn (ApiKeyMeta $meta) => $meta->key === 'my_custom_key'),
|
||||
)->willReturn(ApiKey::create());
|
||||
|
||||
$this->commandTester->execute(['key' => 'my_custom_key']);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user