mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-19 00:39:55 +03:00
Merge pull request #209 from acelaya/feature/cli-refactoring
CLI Refactoring
This commit is contained in:
commit
076b0cf867
21 changed files with 70 additions and 69 deletions
|
@ -1,5 +1,6 @@
|
||||||
#!/usr/bin/env php
|
#!/usr/bin/env php
|
||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Shlinkio\Shlink\CLI\Factory\InstallApplicationFactory;
|
use Shlinkio\Shlink\CLI\Factory\InstallApplicationFactory;
|
||||||
use Shlinkio\Shlink\CLI\Install\Plugin\DatabaseConfigCustomizer;
|
use Shlinkio\Shlink\CLI\Install\Plugin\DatabaseConfigCustomizer;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#!/usr/bin/env php
|
#!/usr/bin/env php
|
||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Shlinkio\Shlink\CLI\Factory\InstallApplicationFactory;
|
use Shlinkio\Shlink\CLI\Factory\InstallApplicationFactory;
|
||||||
use Shlinkio\Shlink\CLI\Install\Plugin\DatabaseConfigCustomizer;
|
use Shlinkio\Shlink\CLI\Install\Plugin\DatabaseConfigCustomizer;
|
||||||
|
|
|
@ -9,12 +9,12 @@ return [
|
||||||
'cli' => [
|
'cli' => [
|
||||||
'locale' => Common\env('CLI_LOCALE', 'en'),
|
'locale' => Common\env('CLI_LOCALE', 'en'),
|
||||||
'commands' => [
|
'commands' => [
|
||||||
Command\Shortcode\GenerateShortcodeCommand::NAME => Command\Shortcode\GenerateShortcodeCommand::class,
|
Command\ShortUrl\GenerateShortUrlCommand::NAME => Command\ShortUrl\GenerateShortUrlCommand::class,
|
||||||
Command\Shortcode\ResolveUrlCommand::NAME => Command\Shortcode\ResolveUrlCommand::class,
|
Command\ShortUrl\ResolveUrlCommand::NAME => Command\ShortUrl\ResolveUrlCommand::class,
|
||||||
Command\Shortcode\ListShortcodesCommand::NAME => Command\Shortcode\ListShortcodesCommand::class,
|
Command\ShortUrl\ListShortUrlsCommand::NAME => Command\ShortUrl\ListShortUrlsCommand::class,
|
||||||
Command\Shortcode\GetVisitsCommand::NAME => Command\Shortcode\GetVisitsCommand::class,
|
Command\ShortUrl\GetVisitsCommand::NAME => Command\ShortUrl\GetVisitsCommand::class,
|
||||||
Command\Shortcode\GeneratePreviewCommand::NAME => Command\Shortcode\GeneratePreviewCommand::class,
|
Command\ShortUrl\GeneratePreviewCommand::NAME => Command\ShortUrl\GeneratePreviewCommand::class,
|
||||||
Command\Shortcode\DeleteShortCodeCommand::NAME => Command\Shortcode\DeleteShortCodeCommand::class,
|
Command\ShortUrl\DeleteShortUrlCommand::NAME => Command\ShortUrl\DeleteShortUrlCommand::class,
|
||||||
|
|
||||||
Command\Visit\ProcessVisitsCommand::NAME => Command\Visit\ProcessVisitsCommand::class,
|
Command\Visit\ProcessVisitsCommand::NAME => Command\Visit\ProcessVisitsCommand::class,
|
||||||
|
|
||||||
|
|
|
@ -17,12 +17,12 @@ return [
|
||||||
'factories' => [
|
'factories' => [
|
||||||
Application::class => ApplicationFactory::class,
|
Application::class => ApplicationFactory::class,
|
||||||
|
|
||||||
Command\Shortcode\GenerateShortcodeCommand::class => ConfigAbstractFactory::class,
|
Command\ShortUrl\GenerateShortUrlCommand::class => ConfigAbstractFactory::class,
|
||||||
Command\Shortcode\ResolveUrlCommand::class => ConfigAbstractFactory::class,
|
Command\ShortUrl\ResolveUrlCommand::class => ConfigAbstractFactory::class,
|
||||||
Command\Shortcode\ListShortcodesCommand::class => ConfigAbstractFactory::class,
|
Command\ShortUrl\ListShortUrlsCommand::class => ConfigAbstractFactory::class,
|
||||||
Command\Shortcode\GetVisitsCommand::class => ConfigAbstractFactory::class,
|
Command\ShortUrl\GetVisitsCommand::class => ConfigAbstractFactory::class,
|
||||||
Command\Shortcode\GeneratePreviewCommand::class => ConfigAbstractFactory::class,
|
Command\ShortUrl\GeneratePreviewCommand::class => ConfigAbstractFactory::class,
|
||||||
Command\Shortcode\DeleteShortCodeCommand::class => ConfigAbstractFactory::class,
|
Command\ShortUrl\DeleteShortUrlCommand::class => ConfigAbstractFactory::class,
|
||||||
|
|
||||||
Command\Visit\ProcessVisitsCommand::class => ConfigAbstractFactory::class,
|
Command\Visit\ProcessVisitsCommand::class => ConfigAbstractFactory::class,
|
||||||
|
|
||||||
|
@ -41,24 +41,24 @@ return [
|
||||||
],
|
],
|
||||||
|
|
||||||
ConfigAbstractFactory::class => [
|
ConfigAbstractFactory::class => [
|
||||||
Command\Shortcode\GenerateShortcodeCommand::class => [
|
Command\ShortUrl\GenerateShortUrlCommand::class => [
|
||||||
Service\UrlShortener::class,
|
Service\UrlShortener::class,
|
||||||
'translator',
|
'translator',
|
||||||
'config.url_shortener.domain',
|
'config.url_shortener.domain',
|
||||||
],
|
],
|
||||||
Command\Shortcode\ResolveUrlCommand::class => [Service\UrlShortener::class, 'translator'],
|
Command\ShortUrl\ResolveUrlCommand::class => [Service\UrlShortener::class, 'translator'],
|
||||||
Command\Shortcode\ListShortcodesCommand::class => [
|
Command\ShortUrl\ListShortUrlsCommand::class => [
|
||||||
Service\ShortUrlService::class,
|
Service\ShortUrlService::class,
|
||||||
'translator',
|
'translator',
|
||||||
'config.url_shortener.domain',
|
'config.url_shortener.domain',
|
||||||
],
|
],
|
||||||
Command\Shortcode\GetVisitsCommand::class => [Service\VisitsTracker::class, 'translator'],
|
Command\ShortUrl\GetVisitsCommand::class => [Service\VisitsTracker::class, 'translator'],
|
||||||
Command\Shortcode\GeneratePreviewCommand::class => [
|
Command\ShortUrl\GeneratePreviewCommand::class => [
|
||||||
Service\ShortUrlService::class,
|
Service\ShortUrlService::class,
|
||||||
PreviewGenerator::class,
|
PreviewGenerator::class,
|
||||||
'translator',
|
'translator',
|
||||||
],
|
],
|
||||||
Command\Shortcode\DeleteShortCodeCommand::class => [
|
Command\ShortUrl\DeleteShortUrlCommand::class => [
|
||||||
Service\ShortUrl\DeleteShortUrlService::class,
|
Service\ShortUrl\DeleteShortUrlService::class,
|
||||||
'translator',
|
'translator',
|
||||||
],
|
],
|
||||||
|
|
Binary file not shown.
|
@ -1,8 +1,8 @@
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Shlink 1.0\n"
|
"Project-Id-Version: Shlink 1.0\n"
|
||||||
"POT-Creation-Date: 2018-09-15 17:57+0200\n"
|
"POT-Creation-Date: 2018-09-16 18:36+0200\n"
|
||||||
"PO-Revision-Date: 2018-09-15 18:02+0200\n"
|
"PO-Revision-Date: 2018-09-16 18:37+0200\n"
|
||||||
"Last-Translator: Alejandro Celaya <alejandro@alejandrocelaya.com>\n"
|
"Last-Translator: Alejandro Celaya <alejandro@alejandrocelaya.com>\n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
"Language: es_ES\n"
|
"Language: es_ES\n"
|
||||||
|
@ -83,8 +83,8 @@ msgstr "Clave secreta: \"%s\""
|
||||||
msgid "Deletes a short URL"
|
msgid "Deletes a short URL"
|
||||||
msgstr "Elimina una URL"
|
msgstr "Elimina una URL"
|
||||||
|
|
||||||
msgid "The short code to be deleted"
|
msgid "The short code for the short URL to be deleted"
|
||||||
msgstr "El código corto a eliminar"
|
msgstr "El código corto de la URL corta a eliminar"
|
||||||
|
|
||||||
msgid ""
|
msgid ""
|
||||||
"Ignores the safety visits threshold check, which could make short URLs with "
|
"Ignores the safety visits threshold check, which could make short URLs with "
|
||||||
|
@ -135,9 +135,8 @@ msgstr " <info>¡Correcto!</info>"
|
||||||
msgid "Error"
|
msgid "Error"
|
||||||
msgstr "Error"
|
msgstr "Error"
|
||||||
|
|
||||||
msgid "Generates a short code for provided URL and returns the short URL"
|
msgid "Generates a short URL for provided long URL and returns it"
|
||||||
msgstr ""
|
msgstr "Genera una URL corta para la URL larga proporcionada y la devuelve"
|
||||||
"Genera un código corto para la URL proporcionada y devuelve la URL acortada"
|
|
||||||
|
|
||||||
msgid "The long URL to parse"
|
msgid "The long URL to parse"
|
||||||
msgstr "La URL larga a procesar"
|
msgstr "La URL larga a procesar"
|
||||||
|
@ -268,8 +267,8 @@ msgstr "Número de visitas"
|
||||||
msgid "Tags"
|
msgid "Tags"
|
||||||
msgstr "Etiquetas"
|
msgstr "Etiquetas"
|
||||||
|
|
||||||
msgid "Short codes properly listed"
|
msgid "Short URLs properly listed"
|
||||||
msgstr "Códigos cortos correctamente listados"
|
msgstr "URLs cortas listadas correctamente"
|
||||||
|
|
||||||
msgid "Continue with page"
|
msgid "Continue with page"
|
||||||
msgstr "Continuar con la página"
|
msgstr "Continuar con la página"
|
||||||
|
|
|
@ -28,7 +28,7 @@ class GenerateCharsetCommand extends Command
|
||||||
public function configure()
|
public function configure()
|
||||||
{
|
{
|
||||||
$this->setName(self::NAME)
|
$this->setName(self::NAME)
|
||||||
->setDescription(sprintf($this->translator->translate(
|
->setDescription(\sprintf($this->translator->translate(
|
||||||
'Generates a character set sample just by shuffling the default one, "%s". '
|
'Generates a character set sample just by shuffling the default one, "%s". '
|
||||||
. 'Then it can be set in the SHORTCODE_CHARS environment variable'
|
. 'Then it can be set in the SHORTCODE_CHARS environment variable'
|
||||||
), UrlShortener::DEFAULT_CHARS));
|
), UrlShortener::DEFAULT_CHARS));
|
||||||
|
|
|
@ -102,7 +102,7 @@ class InstallCommand extends Command
|
||||||
|
|
||||||
$this->io->writeln([
|
$this->io->writeln([
|
||||||
'<info>Welcome to Shlink!!</info>',
|
'<info>Welcome to Shlink!!</info>',
|
||||||
'This will guide you through the installation process.',
|
'This tool will guide you through the installation process.',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Check if a cached config file exists and drop it if so
|
// Check if a cached config file exists and drop it if so
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\CLI\Command\Shortcode;
|
namespace Shlinkio\Shlink\CLI\Command\ShortUrl;
|
||||||
|
|
||||||
use Shlinkio\Shlink\Core\Exception;
|
use Shlinkio\Shlink\Core\Exception;
|
||||||
use Shlinkio\Shlink\Core\Service\ShortUrl\DeleteShortUrlServiceInterface;
|
use Shlinkio\Shlink\Core\Service\ShortUrl\DeleteShortUrlServiceInterface;
|
||||||
|
@ -13,10 +13,10 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||||
use Zend\I18n\Translator\TranslatorInterface;
|
use Zend\I18n\Translator\TranslatorInterface;
|
||||||
|
|
||||||
class DeleteShortCodeCommand extends Command
|
class DeleteShortUrlCommand extends Command
|
||||||
{
|
{
|
||||||
public const NAME = 'short-code:delete';
|
public const NAME = 'short-url:delete';
|
||||||
private const ALIASES = [];
|
private const ALIASES = ['short-code:delete'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var DeleteShortUrlServiceInterface
|
* @var DeleteShortUrlServiceInterface
|
||||||
|
@ -45,7 +45,7 @@ class DeleteShortCodeCommand extends Command
|
||||||
->addArgument(
|
->addArgument(
|
||||||
'shortCode',
|
'shortCode',
|
||||||
InputArgument::REQUIRED,
|
InputArgument::REQUIRED,
|
||||||
$this->translator->translate('The short code to be deleted')
|
$this->translator->translate('The short code for the short URL to be deleted')
|
||||||
)
|
)
|
||||||
->addOption(
|
->addOption(
|
||||||
'ignore-threshold',
|
'ignore-threshold',
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\CLI\Command\Shortcode;
|
namespace Shlinkio\Shlink\CLI\Command\ShortUrl;
|
||||||
|
|
||||||
use Shlinkio\Shlink\Common\Exception\PreviewGenerationException;
|
use Shlinkio\Shlink\Common\Exception\PreviewGenerationException;
|
||||||
use Shlinkio\Shlink\Common\Service\PreviewGeneratorInterface;
|
use Shlinkio\Shlink\Common\Service\PreviewGeneratorInterface;
|
||||||
|
@ -14,8 +14,8 @@ use Zend\I18n\Translator\TranslatorInterface;
|
||||||
|
|
||||||
class GeneratePreviewCommand extends Command
|
class GeneratePreviewCommand extends Command
|
||||||
{
|
{
|
||||||
public const NAME = 'short-code:process-previews';
|
public const NAME = 'short-url:process-previews';
|
||||||
private const ALIASES = ['shortcode:process-previews'];
|
private const ALIASES = ['shortcode:process-previews', 'short-code:process-previews'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var PreviewGeneratorInterface
|
* @var PreviewGeneratorInterface
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\CLI\Command\Shortcode;
|
namespace Shlinkio\Shlink\CLI\Command\ShortUrl;
|
||||||
|
|
||||||
use Shlinkio\Shlink\Core\Exception\InvalidUrlException;
|
use Shlinkio\Shlink\Core\Exception\InvalidUrlException;
|
||||||
use Shlinkio\Shlink\Core\Exception\NonUniqueSlugException;
|
use Shlinkio\Shlink\Core\Exception\NonUniqueSlugException;
|
||||||
|
@ -16,12 +16,12 @@ use Symfony\Component\Console\Style\SymfonyStyle;
|
||||||
use Zend\Diactoros\Uri;
|
use Zend\Diactoros\Uri;
|
||||||
use Zend\I18n\Translator\TranslatorInterface;
|
use Zend\I18n\Translator\TranslatorInterface;
|
||||||
|
|
||||||
class GenerateShortcodeCommand extends Command
|
class GenerateShortUrlCommand extends Command
|
||||||
{
|
{
|
||||||
use ShortUrlBuilderTrait;
|
use ShortUrlBuilderTrait;
|
||||||
|
|
||||||
public const NAME = 'short-code:generate';
|
public const NAME = 'short-url:generate';
|
||||||
private const ALIASES = ['shortcode:generate'];
|
private const ALIASES = ['shortcode:generate', 'short-code:generate'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var UrlShortenerInterface
|
* @var UrlShortenerInterface
|
||||||
|
@ -53,7 +53,7 @@ class GenerateShortcodeCommand extends Command
|
||||||
->setName(self::NAME)
|
->setName(self::NAME)
|
||||||
->setAliases(self::ALIASES)
|
->setAliases(self::ALIASES)
|
||||||
->setDescription(
|
->setDescription(
|
||||||
$this->translator->translate('Generates a short code for provided URL and returns the short URL')
|
$this->translator->translate('Generates a short URL for provided long URL and returns it')
|
||||||
)
|
)
|
||||||
->addArgument('longUrl', InputArgument::REQUIRED, $this->translator->translate('The long URL to parse'))
|
->addArgument('longUrl', InputArgument::REQUIRED, $this->translator->translate('The long URL to parse'))
|
||||||
->addOption(
|
->addOption(
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\CLI\Command\Shortcode;
|
namespace Shlinkio\Shlink\CLI\Command\ShortUrl;
|
||||||
|
|
||||||
use Shlinkio\Shlink\Common\Util\DateRange;
|
use Shlinkio\Shlink\Common\Util\DateRange;
|
||||||
use Shlinkio\Shlink\Core\Service\VisitsTrackerInterface;
|
use Shlinkio\Shlink\Core\Service\VisitsTrackerInterface;
|
||||||
|
@ -15,8 +15,8 @@ use Zend\I18n\Translator\TranslatorInterface;
|
||||||
|
|
||||||
class GetVisitsCommand extends Command
|
class GetVisitsCommand extends Command
|
||||||
{
|
{
|
||||||
public const NAME = 'short-code:visits';
|
public const NAME = 'short-url:visits';
|
||||||
private const ALIASES = ['shortcode:visits'];
|
private const ALIASES = ['shortcode:visits', 'short-code:visits'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var VisitsTrackerInterface
|
* @var VisitsTrackerInterface
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\CLI\Command\Shortcode;
|
namespace Shlinkio\Shlink\CLI\Command\ShortUrl;
|
||||||
|
|
||||||
use Shlinkio\Shlink\Common\Paginator\Adapter\PaginableRepositoryAdapter;
|
use Shlinkio\Shlink\Common\Paginator\Adapter\PaginableRepositoryAdapter;
|
||||||
use Shlinkio\Shlink\Common\Paginator\Util\PaginatorUtilsTrait;
|
use Shlinkio\Shlink\Common\Paginator\Util\PaginatorUtilsTrait;
|
||||||
|
@ -14,12 +14,12 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||||
use Zend\I18n\Translator\TranslatorInterface;
|
use Zend\I18n\Translator\TranslatorInterface;
|
||||||
|
|
||||||
class ListShortcodesCommand extends Command
|
class ListShortUrlsCommand extends Command
|
||||||
{
|
{
|
||||||
use PaginatorUtilsTrait;
|
use PaginatorUtilsTrait;
|
||||||
|
|
||||||
public const NAME = 'short-code:list';
|
public const NAME = 'short-url:list';
|
||||||
private const ALIASES = ['shortcode:list'];
|
private const ALIASES = ['shortcode:list', 'short-code:list'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var ShortUrlServiceInterface
|
* @var ShortUrlServiceInterface
|
||||||
|
@ -132,7 +132,7 @@ class ListShortcodesCommand extends Command
|
||||||
|
|
||||||
if ($this->isLastPage($result)) {
|
if ($this->isLastPage($result)) {
|
||||||
$continue = false;
|
$continue = false;
|
||||||
$io->success($this->translator->translate('Short codes properly listed'));
|
$io->success($this->translator->translate('Short URLs properly listed'));
|
||||||
} else {
|
} else {
|
||||||
$continue = $io->confirm(
|
$continue = $io->confirm(
|
||||||
\sprintf($this->translator->translate('Continue with page') . ' <options=bold>%s</>?', $page),
|
\sprintf($this->translator->translate('Continue with page') . ' <options=bold>%s</>?', $page),
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\CLI\Command\Shortcode;
|
namespace Shlinkio\Shlink\CLI\Command\ShortUrl;
|
||||||
|
|
||||||
use Shlinkio\Shlink\Core\Exception\EntityDoesNotExistException;
|
use Shlinkio\Shlink\Core\Exception\EntityDoesNotExistException;
|
||||||
use Shlinkio\Shlink\Core\Exception\InvalidShortCodeException;
|
use Shlinkio\Shlink\Core\Exception\InvalidShortCodeException;
|
||||||
|
@ -15,8 +15,8 @@ use Zend\I18n\Translator\TranslatorInterface;
|
||||||
|
|
||||||
class ResolveUrlCommand extends Command
|
class ResolveUrlCommand extends Command
|
||||||
{
|
{
|
||||||
public const NAME = 'short-code:parse';
|
public const NAME = 'short-url:parse';
|
||||||
private const ALIASES = ['shortcode:parse'];
|
private const ALIASES = ['shortcode:parse', 'short-code:parse'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var UrlShortenerInterface
|
* @var UrlShortenerInterface
|
|
@ -50,7 +50,7 @@ class InstallApplicationFactory implements FactoryInterface
|
||||||
$isUpdate
|
$isUpdate
|
||||||
);
|
);
|
||||||
$app->add($command);
|
$app->add($command);
|
||||||
$app->setDefaultCommand($command->getName());
|
$app->setDefaultCommand($command->getName(), true);
|
||||||
|
|
||||||
return $app;
|
return $app;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace ShlinkioTest\Shlink\CLI\Command\Shortcode;
|
namespace ShlinkioTest\Shlink\CLI\Command\ShortUrl;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Prophecy\Argument;
|
use Prophecy\Argument;
|
||||||
use Prophecy\Prophecy\ObjectProphecy;
|
use Prophecy\Prophecy\ObjectProphecy;
|
||||||
use Shlinkio\Shlink\CLI\Command\Shortcode\DeleteShortCodeCommand;
|
use Shlinkio\Shlink\CLI\Command\ShortUrl\DeleteShortUrlCommand;
|
||||||
use Shlinkio\Shlink\Core\Exception;
|
use Shlinkio\Shlink\Core\Exception;
|
||||||
use Shlinkio\Shlink\Core\Service\ShortUrl\DeleteShortUrlServiceInterface;
|
use Shlinkio\Shlink\Core\Service\ShortUrl\DeleteShortUrlServiceInterface;
|
||||||
use Symfony\Component\Console\Application;
|
use Symfony\Component\Console\Application;
|
||||||
|
@ -28,7 +28,7 @@ class DeleteShortCodeCommandTest extends TestCase
|
||||||
{
|
{
|
||||||
$this->service = $this->prophesize(DeleteShortUrlServiceInterface::class);
|
$this->service = $this->prophesize(DeleteShortUrlServiceInterface::class);
|
||||||
|
|
||||||
$command = new DeleteShortCodeCommand($this->service->reveal(), Translator::factory([]));
|
$command = new DeleteShortUrlCommand($this->service->reveal(), Translator::factory([]));
|
||||||
$app = new Application();
|
$app = new Application();
|
||||||
$app->add($command);
|
$app->add($command);
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace ShlinkioTest\Shlink\CLI\Command\Shortcode;
|
namespace ShlinkioTest\Shlink\CLI\Command\ShortUrl;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Prophecy\Argument;
|
use Prophecy\Argument;
|
||||||
use Prophecy\Prophecy\ObjectProphecy;
|
use Prophecy\Prophecy\ObjectProphecy;
|
||||||
use Shlinkio\Shlink\CLI\Command\Shortcode\GeneratePreviewCommand;
|
use Shlinkio\Shlink\CLI\Command\ShortUrl\GeneratePreviewCommand;
|
||||||
use Shlinkio\Shlink\Common\Exception\PreviewGenerationException;
|
use Shlinkio\Shlink\Common\Exception\PreviewGenerationException;
|
||||||
use Shlinkio\Shlink\Common\Service\PreviewGenerator;
|
use Shlinkio\Shlink\Common\Service\PreviewGenerator;
|
||||||
use Shlinkio\Shlink\Core\Entity\ShortUrl;
|
use Shlinkio\Shlink\Core\Entity\ShortUrl;
|
|
@ -1,12 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace ShlinkioTest\Shlink\CLI\Command\Shortcode;
|
namespace ShlinkioTest\Shlink\CLI\Command\ShortUrl;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Prophecy\Argument;
|
use Prophecy\Argument;
|
||||||
use Prophecy\Prophecy\ObjectProphecy;
|
use Prophecy\Prophecy\ObjectProphecy;
|
||||||
use Shlinkio\Shlink\CLI\Command\Shortcode\GenerateShortcodeCommand;
|
use Shlinkio\Shlink\CLI\Command\ShortUrl\GenerateShortUrlCommand;
|
||||||
use Shlinkio\Shlink\Core\Entity\ShortUrl;
|
use Shlinkio\Shlink\Core\Entity\ShortUrl;
|
||||||
use Shlinkio\Shlink\Core\Exception\InvalidUrlException;
|
use Shlinkio\Shlink\Core\Exception\InvalidUrlException;
|
||||||
use Shlinkio\Shlink\Core\Service\UrlShortener;
|
use Shlinkio\Shlink\Core\Service\UrlShortener;
|
||||||
|
@ -28,7 +28,7 @@ class GenerateShortcodeCommandTest extends TestCase
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
$this->urlShortener = $this->prophesize(UrlShortener::class);
|
$this->urlShortener = $this->prophesize(UrlShortener::class);
|
||||||
$command = new GenerateShortcodeCommand($this->urlShortener->reveal(), Translator::factory([]), [
|
$command = new GenerateShortUrlCommand($this->urlShortener->reveal(), Translator::factory([]), [
|
||||||
'schema' => 'http',
|
'schema' => 'http',
|
||||||
'hostname' => 'foo.com',
|
'hostname' => 'foo.com',
|
||||||
]);
|
]);
|
|
@ -1,12 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace ShlinkioTest\Shlink\CLI\Command\Shortcode;
|
namespace ShlinkioTest\Shlink\CLI\Command\ShortUrl;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Prophecy\Argument;
|
use Prophecy\Argument;
|
||||||
use Prophecy\Prophecy\ObjectProphecy;
|
use Prophecy\Prophecy\ObjectProphecy;
|
||||||
use Shlinkio\Shlink\CLI\Command\Shortcode\GetVisitsCommand;
|
use Shlinkio\Shlink\CLI\Command\ShortUrl\GetVisitsCommand;
|
||||||
use Shlinkio\Shlink\Common\Util\DateRange;
|
use Shlinkio\Shlink\Common\Util\DateRange;
|
||||||
use Shlinkio\Shlink\Core\Entity\Visit;
|
use Shlinkio\Shlink\Core\Entity\Visit;
|
||||||
use Shlinkio\Shlink\Core\Entity\VisitLocation;
|
use Shlinkio\Shlink\Core\Entity\VisitLocation;
|
|
@ -1,12 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace ShlinkioTest\Shlink\CLI\Command\Shortcode;
|
namespace ShlinkioTest\Shlink\CLI\Command\ShortUrl;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Prophecy\Argument;
|
use Prophecy\Argument;
|
||||||
use Prophecy\Prophecy\ObjectProphecy;
|
use Prophecy\Prophecy\ObjectProphecy;
|
||||||
use Shlinkio\Shlink\CLI\Command\Shortcode\ListShortcodesCommand;
|
use Shlinkio\Shlink\CLI\Command\ShortUrl\ListShortUrlsCommand;
|
||||||
use Shlinkio\Shlink\Core\Entity\ShortUrl;
|
use Shlinkio\Shlink\Core\Entity\ShortUrl;
|
||||||
use Shlinkio\Shlink\Core\Service\ShortUrlServiceInterface;
|
use Shlinkio\Shlink\Core\Service\ShortUrlServiceInterface;
|
||||||
use Symfony\Component\Console\Application;
|
use Symfony\Component\Console\Application;
|
||||||
|
@ -30,7 +30,7 @@ class ListShortcodesCommandTest extends TestCase
|
||||||
{
|
{
|
||||||
$this->shortUrlService = $this->prophesize(ShortUrlServiceInterface::class);
|
$this->shortUrlService = $this->prophesize(ShortUrlServiceInterface::class);
|
||||||
$app = new Application();
|
$app = new Application();
|
||||||
$command = new ListShortcodesCommand($this->shortUrlService->reveal(), Translator::factory([]), []);
|
$command = new ListShortUrlsCommand($this->shortUrlService->reveal(), Translator::factory([]), []);
|
||||||
$app->add($command);
|
$app->add($command);
|
||||||
$this->commandTester = new CommandTester($command);
|
$this->commandTester = new CommandTester($command);
|
||||||
}
|
}
|
|
@ -1,11 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace ShlinkioTest\Shlink\CLI\Command\Shortcode;
|
namespace ShlinkioTest\Shlink\CLI\Command\ShortUrl;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Prophecy\Prophecy\ObjectProphecy;
|
use Prophecy\Prophecy\ObjectProphecy;
|
||||||
use Shlinkio\Shlink\CLI\Command\Shortcode\ResolveUrlCommand;
|
use Shlinkio\Shlink\CLI\Command\ShortUrl\ResolveUrlCommand;
|
||||||
use Shlinkio\Shlink\Core\Entity\ShortUrl;
|
use Shlinkio\Shlink\Core\Entity\ShortUrl;
|
||||||
use Shlinkio\Shlink\Core\Exception\EntityDoesNotExistException;
|
use Shlinkio\Shlink\Core\Exception\EntityDoesNotExistException;
|
||||||
use Shlinkio\Shlink\Core\Exception\InvalidShortCodeException;
|
use Shlinkio\Shlink\Core\Exception\InvalidShortCodeException;
|
Loading…
Add table
Reference in a new issue