diff --git a/module/CLI/config/cli.config.php b/module/CLI/config/cli.config.php index 46bb90ef..e06ad727 100644 --- a/module/CLI/config/cli.config.php +++ b/module/CLI/config/cli.config.php @@ -8,7 +8,7 @@ return [ 'cli' => [ 'commands' => [ - Command\ShortUrl\GenerateShortUrlCommand::NAME => Command\ShortUrl\GenerateShortUrlCommand::class, + Command\ShortUrl\CreateShortUrlCommand::NAME => Command\ShortUrl\CreateShortUrlCommand::class, Command\ShortUrl\ResolveUrlCommand::NAME => Command\ShortUrl\ResolveUrlCommand::class, Command\ShortUrl\ListShortUrlsCommand::NAME => Command\ShortUrl\ListShortUrlsCommand::class, Command\ShortUrl\GetVisitsCommand::NAME => Command\ShortUrl\GetVisitsCommand::class, diff --git a/module/CLI/config/dependencies.config.php b/module/CLI/config/dependencies.config.php index d89a8af2..cde351ee 100644 --- a/module/CLI/config/dependencies.config.php +++ b/module/CLI/config/dependencies.config.php @@ -39,7 +39,7 @@ return [ ApiKey\RoleResolver::class => ConfigAbstractFactory::class, - Command\ShortUrl\GenerateShortUrlCommand::class => ConfigAbstractFactory::class, + Command\ShortUrl\CreateShortUrlCommand::class => ConfigAbstractFactory::class, Command\ShortUrl\ResolveUrlCommand::class => ConfigAbstractFactory::class, Command\ShortUrl\ListShortUrlsCommand::class => ConfigAbstractFactory::class, Command\ShortUrl\GetVisitsCommand::class => ConfigAbstractFactory::class, @@ -75,7 +75,7 @@ return [ Util\ProcessRunner::class => [SymfonyCli\Helper\ProcessHelper::class], ApiKey\RoleResolver::class => [DomainService::class], - Command\ShortUrl\GenerateShortUrlCommand::class => [ + Command\ShortUrl\CreateShortUrlCommand::class => [ Service\UrlShortener::class, ShortUrlStringifier::class, 'config.url_shortener.default_short_codes_length', diff --git a/module/CLI/src/Command/ShortUrl/GenerateShortUrlCommand.php b/module/CLI/src/Command/ShortUrl/CreateShortUrlCommand.php similarity index 98% rename from module/CLI/src/Command/ShortUrl/GenerateShortUrlCommand.php rename to module/CLI/src/Command/ShortUrl/CreateShortUrlCommand.php index e43b4ec5..26673c6c 100644 --- a/module/CLI/src/Command/ShortUrl/GenerateShortUrlCommand.php +++ b/module/CLI/src/Command/ShortUrl/CreateShortUrlCommand.php @@ -26,9 +26,9 @@ use function method_exists; use function sprintf; use function str_contains; -class GenerateShortUrlCommand extends BaseCommand +class CreateShortUrlCommand extends BaseCommand { - public const NAME = 'short-url:generate'; + public const NAME = 'short-url:create'; public function __construct( private UrlShortenerInterface $urlShortener, @@ -42,6 +42,7 @@ class GenerateShortUrlCommand extends BaseCommand { $this ->setName(self::NAME) + ->setAliases(['short-url:generate']) // Deprecated ->setDescription('Generates a short URL for provided long URL and returns it') ->addArgument('longUrl', InputArgument::REQUIRED, 'The long URL to parse') ->addOption( diff --git a/module/CLI/test/Command/ShortUrl/GenerateShortUrlCommandTest.php b/module/CLI/test/Command/ShortUrl/CreateShortUrlCommandTest.php similarity index 95% rename from module/CLI/test/Command/ShortUrl/GenerateShortUrlCommandTest.php rename to module/CLI/test/Command/ShortUrl/CreateShortUrlCommandTest.php index 19767dc7..14d75f76 100644 --- a/module/CLI/test/Command/ShortUrl/GenerateShortUrlCommandTest.php +++ b/module/CLI/test/Command/ShortUrl/CreateShortUrlCommandTest.php @@ -8,7 +8,7 @@ use PHPUnit\Framework\Assert; use PHPUnit\Framework\TestCase; use Prophecy\Argument; use Prophecy\Prophecy\ObjectProphecy; -use Shlinkio\Shlink\CLI\Command\ShortUrl\GenerateShortUrlCommand; +use Shlinkio\Shlink\CLI\Command\ShortUrl\CreateShortUrlCommand; use Shlinkio\Shlink\CLI\Util\ExitCodes; use Shlinkio\Shlink\Core\Entity\ShortUrl; use Shlinkio\Shlink\Core\Exception\InvalidUrlException; @@ -19,7 +19,7 @@ use Shlinkio\Shlink\Core\ShortUrl\Helper\ShortUrlStringifierInterface; use ShlinkioTest\Shlink\CLI\CliTestUtilsTrait; use Symfony\Component\Console\Tester\CommandTester; -class GenerateShortUrlCommandTest extends TestCase +class CreateShortUrlCommandTest extends TestCase { use CliTestUtilsTrait; @@ -33,7 +33,7 @@ class GenerateShortUrlCommandTest extends TestCase $this->stringifier = $this->prophesize(ShortUrlStringifierInterface::class); $this->stringifier->stringify(Argument::type(ShortUrl::class))->willReturn(''); - $command = new GenerateShortUrlCommand($this->urlShortener->reveal(), $this->stringifier->reveal(), 5); + $command = new CreateShortUrlCommand($this->urlShortener->reveal(), $this->stringifier->reveal(), 5); $this->commandTester = $this->testerForCommand($command); }