mirror of
https://github.com/shlinkio/shlink.git
synced 2024-11-27 16:26:37 +03:00
Renamed rest actions to use the short-url concept instead of the short-code concept
This commit is contained in:
parent
076b0cf867
commit
1f5faee356
18 changed files with 75 additions and 73 deletions
|
@ -8,7 +8,7 @@ return [
|
||||||
'auth' => [
|
'auth' => [
|
||||||
'routes_whitelist' => [
|
'routes_whitelist' => [
|
||||||
Action\AuthenticateAction::class,
|
Action\AuthenticateAction::class,
|
||||||
Action\ShortCode\SingleStepCreateShortCodeAction::class,
|
Action\ShortUrl\SingleStepCreateShortUrlAction::class,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
|
@ -20,14 +20,14 @@ return [
|
||||||
ApiKeyService::class => ConfigAbstractFactory::class,
|
ApiKeyService::class => ConfigAbstractFactory::class,
|
||||||
|
|
||||||
Action\AuthenticateAction::class => ConfigAbstractFactory::class,
|
Action\AuthenticateAction::class => ConfigAbstractFactory::class,
|
||||||
Action\ShortCode\CreateShortCodeAction::class => ConfigAbstractFactory::class,
|
Action\ShortUrl\CreateShortUrlAction::class => ConfigAbstractFactory::class,
|
||||||
Action\ShortCode\SingleStepCreateShortCodeAction::class => ConfigAbstractFactory::class,
|
Action\ShortUrl\SingleStepCreateShortUrlAction::class => ConfigAbstractFactory::class,
|
||||||
Action\ShortCode\EditShortCodeAction::class => ConfigAbstractFactory::class,
|
Action\ShortUrl\EditShortUrlAction::class => ConfigAbstractFactory::class,
|
||||||
Action\ShortCode\DeleteShortCodeAction::class => ConfigAbstractFactory::class,
|
Action\ShortUrl\DeleteShortUrlAction::class => ConfigAbstractFactory::class,
|
||||||
Action\ShortCode\ResolveUrlAction::class => ConfigAbstractFactory::class,
|
Action\ShortUrl\ResolveShortUrlAction::class => ConfigAbstractFactory::class,
|
||||||
Action\Visit\GetVisitsAction::class => ConfigAbstractFactory::class,
|
Action\Visit\GetVisitsAction::class => ConfigAbstractFactory::class,
|
||||||
Action\ShortCode\ListShortCodesAction::class => ConfigAbstractFactory::class,
|
Action\ShortUrl\ListShortUrlsAction::class => ConfigAbstractFactory::class,
|
||||||
Action\ShortCode\EditShortCodeTagsAction::class => ConfigAbstractFactory::class,
|
Action\ShortUrl\EditShortUrlTagsAction::class => ConfigAbstractFactory::class,
|
||||||
Action\Tag\ListTagsAction::class => ConfigAbstractFactory::class,
|
Action\Tag\ListTagsAction::class => ConfigAbstractFactory::class,
|
||||||
Action\Tag\DeleteTagsAction::class => ConfigAbstractFactory::class,
|
Action\Tag\DeleteTagsAction::class => ConfigAbstractFactory::class,
|
||||||
Action\Tag\CreateTagsAction::class => ConfigAbstractFactory::class,
|
Action\Tag\CreateTagsAction::class => ConfigAbstractFactory::class,
|
||||||
|
@ -46,38 +46,38 @@ return [
|
||||||
ApiKeyService::class => ['em'],
|
ApiKeyService::class => ['em'],
|
||||||
|
|
||||||
Action\AuthenticateAction::class => [ApiKeyService::class, JWTService::class, 'translator', 'Logger_Shlink'],
|
Action\AuthenticateAction::class => [ApiKeyService::class, JWTService::class, 'translator', 'Logger_Shlink'],
|
||||||
Action\ShortCode\CreateShortCodeAction::class => [
|
Action\ShortUrl\CreateShortUrlAction::class => [
|
||||||
Service\UrlShortener::class,
|
Service\UrlShortener::class,
|
||||||
'translator',
|
'translator',
|
||||||
'config.url_shortener.domain',
|
'config.url_shortener.domain',
|
||||||
'Logger_Shlink',
|
'Logger_Shlink',
|
||||||
],
|
],
|
||||||
Action\ShortCode\SingleStepCreateShortCodeAction::class => [
|
Action\ShortUrl\SingleStepCreateShortUrlAction::class => [
|
||||||
Service\UrlShortener::class,
|
Service\UrlShortener::class,
|
||||||
'translator',
|
'translator',
|
||||||
ApiKeyService::class,
|
ApiKeyService::class,
|
||||||
'config.url_shortener.domain',
|
'config.url_shortener.domain',
|
||||||
'Logger_Shlink',
|
'Logger_Shlink',
|
||||||
],
|
],
|
||||||
Action\ShortCode\EditShortCodeAction::class => [Service\ShortUrlService::class, 'translator', 'Logger_Shlink'],
|
Action\ShortUrl\EditShortUrlAction::class => [Service\ShortUrlService::class, 'translator', 'Logger_Shlink'],
|
||||||
Action\ShortCode\DeleteShortCodeAction::class => [
|
Action\ShortUrl\DeleteShortUrlAction::class => [
|
||||||
Service\ShortUrl\DeleteShortUrlService::class,
|
Service\ShortUrl\DeleteShortUrlService::class,
|
||||||
'translator',
|
'translator',
|
||||||
'Logger_Shlink',
|
'Logger_Shlink',
|
||||||
],
|
],
|
||||||
Action\ShortCode\ResolveUrlAction::class => [
|
Action\ShortUrl\ResolveShortUrlAction::class => [
|
||||||
Service\UrlShortener::class,
|
Service\UrlShortener::class,
|
||||||
'translator',
|
'translator',
|
||||||
'config.url_shortener.domain',
|
'config.url_shortener.domain',
|
||||||
],
|
],
|
||||||
Action\Visit\GetVisitsAction::class => [Service\VisitsTracker::class, 'translator', 'Logger_Shlink'],
|
Action\Visit\GetVisitsAction::class => [Service\VisitsTracker::class, 'translator', 'Logger_Shlink'],
|
||||||
Action\ShortCode\ListShortCodesAction::class => [
|
Action\ShortUrl\ListShortUrlsAction::class => [
|
||||||
Service\ShortUrlService::class,
|
Service\ShortUrlService::class,
|
||||||
'translator',
|
'translator',
|
||||||
'config.url_shortener.domain',
|
'config.url_shortener.domain',
|
||||||
'Logger_Shlink',
|
'Logger_Shlink',
|
||||||
],
|
],
|
||||||
Action\ShortCode\EditShortCodeTagsAction::class => [
|
Action\ShortUrl\EditShortUrlTagsAction::class => [
|
||||||
Service\ShortUrlService::class,
|
Service\ShortUrlService::class,
|
||||||
'translator',
|
'translator',
|
||||||
'Logger_Shlink',
|
'Logger_Shlink',
|
||||||
|
|
|
@ -11,17 +11,17 @@ return [
|
||||||
Action\AuthenticateAction::getRouteDef(),
|
Action\AuthenticateAction::getRouteDef(),
|
||||||
|
|
||||||
// Short codes
|
// Short codes
|
||||||
Action\ShortCode\CreateShortCodeAction::getRouteDef([
|
Action\ShortUrl\CreateShortUrlAction::getRouteDef([
|
||||||
Middleware\ShortCode\CreateShortCodeContentNegotiationMiddleware::class,
|
Middleware\ShortCode\CreateShortCodeContentNegotiationMiddleware::class,
|
||||||
]),
|
]),
|
||||||
Action\ShortCode\SingleStepCreateShortCodeAction::getRouteDef([
|
Action\ShortUrl\SingleStepCreateShortUrlAction::getRouteDef([
|
||||||
Middleware\ShortCode\CreateShortCodeContentNegotiationMiddleware::class,
|
Middleware\ShortCode\CreateShortCodeContentNegotiationMiddleware::class,
|
||||||
]),
|
]),
|
||||||
Action\ShortCode\EditShortCodeAction::getRouteDef(),
|
Action\ShortUrl\EditShortUrlAction::getRouteDef(),
|
||||||
Action\ShortCode\DeleteShortCodeAction::getRouteDef(),
|
Action\ShortUrl\DeleteShortUrlAction::getRouteDef(),
|
||||||
Action\ShortCode\ResolveUrlAction::getRouteDef(),
|
Action\ShortUrl\ResolveShortUrlAction::getRouteDef(),
|
||||||
Action\ShortCode\ListShortCodesAction::getRouteDef(),
|
Action\ShortUrl\ListShortUrlsAction::getRouteDef(),
|
||||||
Action\ShortCode\EditShortCodeTagsAction::getRouteDef(),
|
Action\ShortUrl\EditShortUrlTagsAction::getRouteDef(),
|
||||||
|
|
||||||
// Visits
|
// Visits
|
||||||
Action\Visit\GetVisitsAction::getRouteDef(),
|
Action\Visit\GetVisitsAction::getRouteDef(),
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\Rest\Action\ShortCode;
|
namespace Shlinkio\Shlink\Rest\Action\ShortUrl;
|
||||||
|
|
||||||
use Psr\Http\Message\ResponseInterface as Response;
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
|
@ -17,7 +17,7 @@ use Shlinkio\Shlink\Rest\Util\RestUtils;
|
||||||
use Zend\Diactoros\Response\JsonResponse;
|
use Zend\Diactoros\Response\JsonResponse;
|
||||||
use Zend\I18n\Translator\TranslatorInterface;
|
use Zend\I18n\Translator\TranslatorInterface;
|
||||||
|
|
||||||
abstract class AbstractCreateShortCodeAction extends AbstractRestAction
|
abstract class AbstractCreateShortUrlAction extends AbstractRestAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var UrlShortenerInterface
|
* @var UrlShortenerInterface
|
|
@ -1,15 +1,16 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\Rest\Action\ShortCode;
|
namespace Shlinkio\Shlink\Rest\Action\ShortUrl;
|
||||||
|
|
||||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
use Shlinkio\Shlink\Core\Exception\InvalidArgumentException;
|
use Shlinkio\Shlink\Core\Exception\InvalidArgumentException;
|
||||||
use Shlinkio\Shlink\Core\Model\CreateShortCodeData;
|
use Shlinkio\Shlink\Core\Model\CreateShortCodeData;
|
||||||
use Shlinkio\Shlink\Core\Model\ShortUrlMeta;
|
use Shlinkio\Shlink\Core\Model\ShortUrlMeta;
|
||||||
|
use Shlinkio\Shlink\Rest\Action\ShortUrl\AbstractCreateShortUrlAction;
|
||||||
use Zend\Diactoros\Uri;
|
use Zend\Diactoros\Uri;
|
||||||
|
|
||||||
class CreateShortCodeAction extends AbstractCreateShortCodeAction
|
class CreateShortUrlAction extends AbstractCreateShortUrlAction
|
||||||
{
|
{
|
||||||
protected const ROUTE_PATH = '/short-codes';
|
protected const ROUTE_PATH = '/short-codes';
|
||||||
protected const ROUTE_ALLOWED_METHODS = [self::METHOD_POST];
|
protected const ROUTE_ALLOWED_METHODS = [self::METHOD_POST];
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\Rest\Action\ShortCode;
|
namespace Shlinkio\Shlink\Rest\Action\ShortUrl;
|
||||||
|
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
use Psr\Http\Message\ServerRequestInterface;
|
use Psr\Http\Message\ServerRequestInterface;
|
||||||
|
@ -14,7 +14,7 @@ use Zend\Diactoros\Response\EmptyResponse;
|
||||||
use Zend\Diactoros\Response\JsonResponse;
|
use Zend\Diactoros\Response\JsonResponse;
|
||||||
use Zend\I18n\Translator\TranslatorInterface;
|
use Zend\I18n\Translator\TranslatorInterface;
|
||||||
|
|
||||||
class DeleteShortCodeAction extends AbstractRestAction
|
class DeleteShortUrlAction extends AbstractRestAction
|
||||||
{
|
{
|
||||||
protected const ROUTE_PATH = '/short-codes/{shortCode}';
|
protected const ROUTE_PATH = '/short-codes/{shortCode}';
|
||||||
protected const ROUTE_ALLOWED_METHODS = [self::METHOD_DELETE];
|
protected const ROUTE_ALLOWED_METHODS = [self::METHOD_DELETE];
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\Rest\Action\ShortCode;
|
namespace Shlinkio\Shlink\Rest\Action\ShortUrl;
|
||||||
|
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
use Psr\Http\Message\ServerRequestInterface;
|
use Psr\Http\Message\ServerRequestInterface;
|
||||||
|
@ -15,7 +15,7 @@ use Zend\Diactoros\Response\EmptyResponse;
|
||||||
use Zend\Diactoros\Response\JsonResponse;
|
use Zend\Diactoros\Response\JsonResponse;
|
||||||
use Zend\I18n\Translator\TranslatorInterface;
|
use Zend\I18n\Translator\TranslatorInterface;
|
||||||
|
|
||||||
class EditShortCodeAction extends AbstractRestAction
|
class EditShortUrlAction extends AbstractRestAction
|
||||||
{
|
{
|
||||||
protected const ROUTE_PATH = '/short-codes/{shortCode}';
|
protected const ROUTE_PATH = '/short-codes/{shortCode}';
|
||||||
protected const ROUTE_ALLOWED_METHODS = [self::METHOD_PUT];
|
protected const ROUTE_ALLOWED_METHODS = [self::METHOD_PUT];
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\Rest\Action\ShortCode;
|
namespace Shlinkio\Shlink\Rest\Action\ShortUrl;
|
||||||
|
|
||||||
use Psr\Http\Message\ResponseInterface as Response;
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
|
@ -13,7 +13,7 @@ use Shlinkio\Shlink\Rest\Util\RestUtils;
|
||||||
use Zend\Diactoros\Response\JsonResponse;
|
use Zend\Diactoros\Response\JsonResponse;
|
||||||
use Zend\I18n\Translator\TranslatorInterface;
|
use Zend\I18n\Translator\TranslatorInterface;
|
||||||
|
|
||||||
class EditShortCodeTagsAction extends AbstractRestAction
|
class EditShortUrlTagsAction extends AbstractRestAction
|
||||||
{
|
{
|
||||||
protected const ROUTE_PATH = '/short-codes/{shortCode}/tags';
|
protected const ROUTE_PATH = '/short-codes/{shortCode}/tags';
|
||||||
protected const ROUTE_ALLOWED_METHODS = [self::METHOD_PUT];
|
protected const ROUTE_ALLOWED_METHODS = [self::METHOD_PUT];
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\Rest\Action\ShortCode;
|
namespace Shlinkio\Shlink\Rest\Action\ShortUrl;
|
||||||
|
|
||||||
use Psr\Http\Message\ResponseInterface as Response;
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
|
@ -14,7 +14,7 @@ use Shlinkio\Shlink\Rest\Util\RestUtils;
|
||||||
use Zend\Diactoros\Response\JsonResponse;
|
use Zend\Diactoros\Response\JsonResponse;
|
||||||
use Zend\I18n\Translator\TranslatorInterface;
|
use Zend\I18n\Translator\TranslatorInterface;
|
||||||
|
|
||||||
class ListShortCodesAction extends AbstractRestAction
|
class ListShortUrlsAction extends AbstractRestAction
|
||||||
{
|
{
|
||||||
use PaginatorUtilsTrait;
|
use PaginatorUtilsTrait;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\Rest\Action\ShortCode;
|
namespace Shlinkio\Shlink\Rest\Action\ShortUrl;
|
||||||
|
|
||||||
use Psr\Http\Message\ResponseInterface as Response;
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
|
@ -15,7 +15,7 @@ use Shlinkio\Shlink\Rest\Util\RestUtils;
|
||||||
use Zend\Diactoros\Response\JsonResponse;
|
use Zend\Diactoros\Response\JsonResponse;
|
||||||
use Zend\I18n\Translator\TranslatorInterface;
|
use Zend\I18n\Translator\TranslatorInterface;
|
||||||
|
|
||||||
class ResolveUrlAction extends AbstractRestAction
|
class ResolveShortUrlAction extends AbstractRestAction
|
||||||
{
|
{
|
||||||
protected const ROUTE_PATH = '/short-codes/{shortCode}';
|
protected const ROUTE_PATH = '/short-codes/{shortCode}';
|
||||||
protected const ROUTE_ALLOWED_METHODS = [self::METHOD_GET];
|
protected const ROUTE_ALLOWED_METHODS = [self::METHOD_GET];
|
|
@ -1,18 +1,19 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\Rest\Action\ShortCode;
|
namespace Shlinkio\Shlink\Rest\Action\ShortUrl;
|
||||||
|
|
||||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use Shlinkio\Shlink\Core\Exception\InvalidArgumentException;
|
use Shlinkio\Shlink\Core\Exception\InvalidArgumentException;
|
||||||
use Shlinkio\Shlink\Core\Model\CreateShortCodeData;
|
use Shlinkio\Shlink\Core\Model\CreateShortCodeData;
|
||||||
use Shlinkio\Shlink\Core\Service\UrlShortenerInterface;
|
use Shlinkio\Shlink\Core\Service\UrlShortenerInterface;
|
||||||
|
use Shlinkio\Shlink\Rest\Action\ShortUrl\AbstractCreateShortUrlAction;
|
||||||
use Shlinkio\Shlink\Rest\Service\ApiKeyServiceInterface;
|
use Shlinkio\Shlink\Rest\Service\ApiKeyServiceInterface;
|
||||||
use Zend\Diactoros\Uri;
|
use Zend\Diactoros\Uri;
|
||||||
use Zend\I18n\Translator\TranslatorInterface;
|
use Zend\I18n\Translator\TranslatorInterface;
|
||||||
|
|
||||||
class SingleStepCreateShortCodeAction extends AbstractCreateShortCodeAction
|
class SingleStepCreateShortUrlAction extends AbstractCreateShortUrlAction
|
||||||
{
|
{
|
||||||
protected const ROUTE_PATH = '/short-codes/shorten';
|
protected const ROUTE_PATH = '/short-codes/shorten';
|
||||||
protected const ROUTE_ALLOWED_METHODS = [self::METHOD_GET];
|
protected const ROUTE_ALLOWED_METHODS = [self::METHOD_GET];
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace ShlinkioTest\Shlink\Rest\Action\ShortCode;
|
namespace ShlinkioTest\Shlink\Rest\Action\ShortUrl;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Prophecy\Argument;
|
use Prophecy\Argument;
|
||||||
|
@ -10,16 +10,16 @@ use Shlinkio\Shlink\Core\Entity\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;
|
||||||
use Shlinkio\Shlink\Core\Service\UrlShortener;
|
use Shlinkio\Shlink\Core\Service\UrlShortener;
|
||||||
use Shlinkio\Shlink\Rest\Action\ShortCode\CreateShortCodeAction;
|
use Shlinkio\Shlink\Rest\Action\ShortUrl\CreateShortUrlAction;
|
||||||
use Shlinkio\Shlink\Rest\Util\RestUtils;
|
use Shlinkio\Shlink\Rest\Util\RestUtils;
|
||||||
use Zend\Diactoros\ServerRequestFactory;
|
use Zend\Diactoros\ServerRequestFactory;
|
||||||
use Zend\Diactoros\Uri;
|
use Zend\Diactoros\Uri;
|
||||||
use Zend\I18n\Translator\Translator;
|
use Zend\I18n\Translator\Translator;
|
||||||
|
|
||||||
class CreateShortCodeActionTest extends TestCase
|
class CreateShortUrlActionTest extends TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var CreateShortCodeAction
|
* @var CreateShortUrlAction
|
||||||
*/
|
*/
|
||||||
protected $action;
|
protected $action;
|
||||||
/**
|
/**
|
||||||
|
@ -30,7 +30,7 @@ class CreateShortCodeActionTest extends TestCase
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
$this->urlShortener = $this->prophesize(UrlShortener::class);
|
$this->urlShortener = $this->prophesize(UrlShortener::class);
|
||||||
$this->action = new CreateShortCodeAction($this->urlShortener->reveal(), Translator::factory([]), [
|
$this->action = new CreateShortUrlAction($this->urlShortener->reveal(), Translator::factory([]), [
|
||||||
'schema' => 'http',
|
'schema' => 'http',
|
||||||
'hostname' => 'foo.com',
|
'hostname' => 'foo.com',
|
||||||
]);
|
]);
|
|
@ -1,23 +1,23 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace ShlinkioTest\Shlink\Rest\Action\ShortCode;
|
namespace ShlinkioTest\Shlink\Rest\Action\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\Core\Exception;
|
use Shlinkio\Shlink\Core\Exception;
|
||||||
use Shlinkio\Shlink\Core\Service\ShortUrl\DeleteShortUrlServiceInterface;
|
use Shlinkio\Shlink\Core\Service\ShortUrl\DeleteShortUrlServiceInterface;
|
||||||
use Shlinkio\Shlink\Rest\Action\ShortCode\DeleteShortCodeAction;
|
use Shlinkio\Shlink\Rest\Action\ShortUrl\DeleteShortUrlAction;
|
||||||
use Shlinkio\Shlink\Rest\Util\RestUtils;
|
use Shlinkio\Shlink\Rest\Util\RestUtils;
|
||||||
use Zend\Diactoros\Response\JsonResponse;
|
use Zend\Diactoros\Response\JsonResponse;
|
||||||
use Zend\Diactoros\ServerRequestFactory;
|
use Zend\Diactoros\ServerRequestFactory;
|
||||||
use Zend\I18n\Translator\Translator;
|
use Zend\I18n\Translator\Translator;
|
||||||
|
|
||||||
class DeleteShortCodeActionTest extends TestCase
|
class DeleteShortUrlActionTest extends TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var DeleteShortCodeAction
|
* @var DeleteShortUrlAction
|
||||||
*/
|
*/
|
||||||
private $action;
|
private $action;
|
||||||
/**
|
/**
|
||||||
|
@ -28,7 +28,7 @@ class DeleteShortCodeActionTest extends TestCase
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
$this->service = $this->prophesize(DeleteShortUrlServiceInterface::class);
|
$this->service = $this->prophesize(DeleteShortUrlServiceInterface::class);
|
||||||
$this->action = new DeleteShortCodeAction($this->service->reveal(), Translator::factory([]));
|
$this->action = new DeleteShortUrlAction($this->service->reveal(), Translator::factory([]));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace ShlinkioTest\Shlink\Rest\Action\ShortCode;
|
namespace ShlinkioTest\Shlink\Rest\Action\ShortUrl;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Prophecy\Argument;
|
use Prophecy\Argument;
|
||||||
|
@ -9,16 +9,16 @@ use Prophecy\Prophecy\ObjectProphecy;
|
||||||
use Shlinkio\Shlink\Core\Entity\ShortUrl;
|
use Shlinkio\Shlink\Core\Entity\ShortUrl;
|
||||||
use Shlinkio\Shlink\Core\Exception\InvalidShortCodeException;
|
use Shlinkio\Shlink\Core\Exception\InvalidShortCodeException;
|
||||||
use Shlinkio\Shlink\Core\Service\ShortUrlServiceInterface;
|
use Shlinkio\Shlink\Core\Service\ShortUrlServiceInterface;
|
||||||
use Shlinkio\Shlink\Rest\Action\ShortCode\EditShortCodeAction;
|
use Shlinkio\Shlink\Rest\Action\ShortUrl\EditShortUrlAction;
|
||||||
use Shlinkio\Shlink\Rest\Util\RestUtils;
|
use Shlinkio\Shlink\Rest\Util\RestUtils;
|
||||||
use Zend\Diactoros\Response\JsonResponse;
|
use Zend\Diactoros\Response\JsonResponse;
|
||||||
use Zend\Diactoros\ServerRequestFactory;
|
use Zend\Diactoros\ServerRequestFactory;
|
||||||
use Zend\I18n\Translator\Translator;
|
use Zend\I18n\Translator\Translator;
|
||||||
|
|
||||||
class EditShortCodeActionTest extends TestCase
|
class EditShortUrlActionTest extends TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var EditShortCodeAction
|
* @var EditShortUrlAction
|
||||||
*/
|
*/
|
||||||
private $action;
|
private $action;
|
||||||
/**
|
/**
|
||||||
|
@ -29,7 +29,7 @@ class EditShortCodeActionTest extends TestCase
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
$this->shortUrlService = $this->prophesize(ShortUrlServiceInterface::class);
|
$this->shortUrlService = $this->prophesize(ShortUrlServiceInterface::class);
|
||||||
$this->action = new EditShortCodeAction($this->shortUrlService->reveal(), Translator::factory([]));
|
$this->action = new EditShortUrlAction($this->shortUrlService->reveal(), Translator::factory([]));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -1,21 +1,21 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace ShlinkioTest\Shlink\Rest\Action\ShortCode;
|
namespace ShlinkioTest\Shlink\Rest\Action\ShortUrl;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Prophecy\Prophecy\ObjectProphecy;
|
use Prophecy\Prophecy\ObjectProphecy;
|
||||||
use Shlinkio\Shlink\Core\Entity\ShortUrl;
|
use Shlinkio\Shlink\Core\Entity\ShortUrl;
|
||||||
use Shlinkio\Shlink\Core\Exception\InvalidShortCodeException;
|
use Shlinkio\Shlink\Core\Exception\InvalidShortCodeException;
|
||||||
use Shlinkio\Shlink\Core\Service\ShortUrlService;
|
use Shlinkio\Shlink\Core\Service\ShortUrlService;
|
||||||
use Shlinkio\Shlink\Rest\Action\ShortCode\EditShortCodeTagsAction;
|
use Shlinkio\Shlink\Rest\Action\ShortUrl\EditShortUrlTagsAction;
|
||||||
use Zend\Diactoros\ServerRequestFactory;
|
use Zend\Diactoros\ServerRequestFactory;
|
||||||
use Zend\I18n\Translator\Translator;
|
use Zend\I18n\Translator\Translator;
|
||||||
|
|
||||||
class EditShortCodeTagsActionTest extends TestCase
|
class EditShortUrlTagsActionTest extends TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var EditShortCodeTagsAction
|
* @var EditShortUrlTagsAction
|
||||||
*/
|
*/
|
||||||
protected $action;
|
protected $action;
|
||||||
/**
|
/**
|
||||||
|
@ -26,7 +26,7 @@ class EditShortCodeTagsActionTest extends TestCase
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
$this->shortUrlService = $this->prophesize(ShortUrlService::class);
|
$this->shortUrlService = $this->prophesize(ShortUrlService::class);
|
||||||
$this->action = new EditShortCodeTagsAction($this->shortUrlService->reveal(), Translator::factory([]));
|
$this->action = new EditShortUrlTagsAction($this->shortUrlService->reveal(), Translator::factory([]));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -1,21 +1,21 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace ShlinkioTest\Shlink\Rest\Action\ShortCode;
|
namespace ShlinkioTest\Shlink\Rest\Action\ShortUrl;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Prophecy\Prophecy\ObjectProphecy;
|
use Prophecy\Prophecy\ObjectProphecy;
|
||||||
use Shlinkio\Shlink\Core\Service\ShortUrlService;
|
use Shlinkio\Shlink\Core\Service\ShortUrlService;
|
||||||
use Shlinkio\Shlink\Rest\Action\ShortCode\ListShortCodesAction;
|
use Shlinkio\Shlink\Rest\Action\ShortUrl\ListShortUrlsAction;
|
||||||
use Zend\Diactoros\ServerRequestFactory;
|
use Zend\Diactoros\ServerRequestFactory;
|
||||||
use Zend\I18n\Translator\Translator;
|
use Zend\I18n\Translator\Translator;
|
||||||
use Zend\Paginator\Adapter\ArrayAdapter;
|
use Zend\Paginator\Adapter\ArrayAdapter;
|
||||||
use Zend\Paginator\Paginator;
|
use Zend\Paginator\Paginator;
|
||||||
|
|
||||||
class ListShortCodesActionTest extends TestCase
|
class ListShortUrlsActionTest extends TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var ListShortCodesAction
|
* @var ListShortUrlsAction
|
||||||
*/
|
*/
|
||||||
protected $action;
|
protected $action;
|
||||||
/**
|
/**
|
||||||
|
@ -26,7 +26,7 @@ class ListShortCodesActionTest extends TestCase
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
$this->service = $this->prophesize(ShortUrlService::class);
|
$this->service = $this->prophesize(ShortUrlService::class);
|
||||||
$this->action = new ListShortCodesAction($this->service->reveal(), Translator::factory([]), [
|
$this->action = new ListShortUrlsAction($this->service->reveal(), Translator::factory([]), [
|
||||||
'hostname' => 'doma.in',
|
'hostname' => 'doma.in',
|
||||||
'schema' => 'https',
|
'schema' => 'https',
|
||||||
]);
|
]);
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace ShlinkioTest\Shlink\Rest\Action\ShortCode;
|
namespace ShlinkioTest\Shlink\Rest\Action\ShortUrl;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Prophecy\Prophecy\ObjectProphecy;
|
use Prophecy\Prophecy\ObjectProphecy;
|
||||||
|
@ -9,15 +9,15 @@ 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;
|
||||||
use Shlinkio\Shlink\Core\Service\UrlShortener;
|
use Shlinkio\Shlink\Core\Service\UrlShortener;
|
||||||
use Shlinkio\Shlink\Rest\Action\ShortCode\ResolveUrlAction;
|
use Shlinkio\Shlink\Rest\Action\ShortUrl\ResolveShortUrlAction;
|
||||||
use Shlinkio\Shlink\Rest\Util\RestUtils;
|
use Shlinkio\Shlink\Rest\Util\RestUtils;
|
||||||
use Zend\Diactoros\ServerRequestFactory;
|
use Zend\Diactoros\ServerRequestFactory;
|
||||||
use Zend\I18n\Translator\Translator;
|
use Zend\I18n\Translator\Translator;
|
||||||
|
|
||||||
class ResolveUrlActionTest extends TestCase
|
class ResolveShortUrlActionTest extends TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var ResolveUrlAction
|
* @var ResolveShortUrlAction
|
||||||
*/
|
*/
|
||||||
protected $action;
|
protected $action;
|
||||||
/**
|
/**
|
||||||
|
@ -28,7 +28,7 @@ class ResolveUrlActionTest extends TestCase
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
$this->urlShortener = $this->prophesize(UrlShortener::class);
|
$this->urlShortener = $this->prophesize(UrlShortener::class);
|
||||||
$this->action = new ResolveUrlAction($this->urlShortener->reveal(), Translator::factory([]), []);
|
$this->action = new ResolveShortUrlAction($this->urlShortener->reveal(), Translator::factory([]), []);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace ShlinkioTest\Shlink\Rest\Action\ShortCode;
|
namespace ShlinkioTest\Shlink\Rest\Action\ShortUrl;
|
||||||
|
|
||||||
use PHPUnit\Framework\Assert;
|
use PHPUnit\Framework\Assert;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
@ -10,17 +10,17 @@ use Prophecy\Prophecy\ObjectProphecy;
|
||||||
use Psr\Http\Message\UriInterface;
|
use Psr\Http\Message\UriInterface;
|
||||||
use Shlinkio\Shlink\Core\Entity\ShortUrl;
|
use Shlinkio\Shlink\Core\Entity\ShortUrl;
|
||||||
use Shlinkio\Shlink\Core\Service\UrlShortenerInterface;
|
use Shlinkio\Shlink\Core\Service\UrlShortenerInterface;
|
||||||
use Shlinkio\Shlink\Rest\Action\ShortCode\SingleStepCreateShortCodeAction;
|
use Shlinkio\Shlink\Rest\Action\ShortUrl\SingleStepCreateShortUrlAction;
|
||||||
use Shlinkio\Shlink\Rest\Entity\ApiKey;
|
use Shlinkio\Shlink\Rest\Entity\ApiKey;
|
||||||
use Shlinkio\Shlink\Rest\Service\ApiKeyServiceInterface;
|
use Shlinkio\Shlink\Rest\Service\ApiKeyServiceInterface;
|
||||||
use Zend\Diactoros\Response\JsonResponse;
|
use Zend\Diactoros\Response\JsonResponse;
|
||||||
use Zend\Diactoros\ServerRequestFactory;
|
use Zend\Diactoros\ServerRequestFactory;
|
||||||
use Zend\I18n\Translator\Translator;
|
use Zend\I18n\Translator\Translator;
|
||||||
|
|
||||||
class SingleStepCreateShortCodeActionTest extends TestCase
|
class SingleStepCreateShortUrlActionTest extends TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var SingleStepCreateShortCodeAction
|
* @var SingleStepCreateShortUrlAction
|
||||||
*/
|
*/
|
||||||
private $action;
|
private $action;
|
||||||
/**
|
/**
|
||||||
|
@ -37,7 +37,7 @@ class SingleStepCreateShortCodeActionTest extends TestCase
|
||||||
$this->urlShortener = $this->prophesize(UrlShortenerInterface::class);
|
$this->urlShortener = $this->prophesize(UrlShortenerInterface::class);
|
||||||
$this->apiKeyService = $this->prophesize(ApiKeyServiceInterface::class);
|
$this->apiKeyService = $this->prophesize(ApiKeyServiceInterface::class);
|
||||||
|
|
||||||
$this->action = new SingleStepCreateShortCodeAction(
|
$this->action = new SingleStepCreateShortUrlAction(
|
||||||
$this->urlShortener->reveal(),
|
$this->urlShortener->reveal(),
|
||||||
Translator::factory([]),
|
Translator::factory([]),
|
||||||
$this->apiKeyService->reveal(),
|
$this->apiKeyService->reveal(),
|
Loading…
Reference in a new issue