mirror of
https://github.com/shlinkio/shlink.git
synced 2024-12-28 09:51:40 -06:00
Renamed rest middlewares to use the short-url concept instead of the short-code concept
This commit is contained in:
parent
1f5faee356
commit
622edd2ed1
@ -37,7 +37,7 @@ return [
|
|||||||
Middleware\CrossDomainMiddleware::class => InvokableFactory::class,
|
Middleware\CrossDomainMiddleware::class => InvokableFactory::class,
|
||||||
Middleware\PathVersionMiddleware::class => InvokableFactory::class,
|
Middleware\PathVersionMiddleware::class => InvokableFactory::class,
|
||||||
Middleware\CheckAuthenticationMiddleware::class => ConfigAbstractFactory::class,
|
Middleware\CheckAuthenticationMiddleware::class => ConfigAbstractFactory::class,
|
||||||
Middleware\ShortCode\CreateShortCodeContentNegotiationMiddleware::class => InvokableFactory::class,
|
Middleware\ShortUrl\CreateShortUrlContentNegotiationMiddleware::class => InvokableFactory::class,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
|
@ -12,10 +12,10 @@ return [
|
|||||||
|
|
||||||
// Short codes
|
// Short codes
|
||||||
Action\ShortUrl\CreateShortUrlAction::getRouteDef([
|
Action\ShortUrl\CreateShortUrlAction::getRouteDef([
|
||||||
Middleware\ShortCode\CreateShortCodeContentNegotiationMiddleware::class,
|
Middleware\ShortUrl\CreateShortUrlContentNegotiationMiddleware::class,
|
||||||
]),
|
]),
|
||||||
Action\ShortUrl\SingleStepCreateShortUrlAction::getRouteDef([
|
Action\ShortUrl\SingleStepCreateShortUrlAction::getRouteDef([
|
||||||
Middleware\ShortCode\CreateShortCodeContentNegotiationMiddleware::class,
|
Middleware\ShortUrl\CreateShortUrlContentNegotiationMiddleware::class,
|
||||||
]),
|
]),
|
||||||
Action\ShortUrl\EditShortUrlAction::getRouteDef(),
|
Action\ShortUrl\EditShortUrlAction::getRouteDef(),
|
||||||
Action\ShortUrl\DeleteShortUrlAction::getRouteDef(),
|
Action\ShortUrl\DeleteShortUrlAction::getRouteDef(),
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\Rest\Middleware\ShortCode;
|
namespace Shlinkio\Shlink\Rest\Middleware\ShortUrl;
|
||||||
|
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
use Psr\Http\Message\ServerRequestInterface;
|
use Psr\Http\Message\ServerRequestInterface;
|
||||||
@ -10,7 +10,7 @@ use Psr\Http\Server\RequestHandlerInterface;
|
|||||||
use Zend\Diactoros\Response;
|
use Zend\Diactoros\Response;
|
||||||
use Zend\Diactoros\Response\JsonResponse;
|
use Zend\Diactoros\Response\JsonResponse;
|
||||||
|
|
||||||
class CreateShortCodeContentNegotiationMiddleware implements MiddlewareInterface
|
class CreateShortUrlContentNegotiationMiddleware implements MiddlewareInterface
|
||||||
{
|
{
|
||||||
private const PLAIN_TEXT = 'text';
|
private const PLAIN_TEXT = 'text';
|
||||||
private const JSON = 'json';
|
private const JSON = 'json';
|
@ -1,21 +1,21 @@
|
|||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace ShlinkioTest\Shlink\Rest\Middleware\ShortCode;
|
namespace ShlinkioTest\Shlink\Rest\Middleware\ShortUrl;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Prophecy\Argument;
|
use Prophecy\Argument;
|
||||||
use Psr\Http\Message\ServerRequestInterface;
|
use Psr\Http\Message\ServerRequestInterface;
|
||||||
use Psr\Http\Server\RequestHandlerInterface;
|
use Psr\Http\Server\RequestHandlerInterface;
|
||||||
use Shlinkio\Shlink\Rest\Middleware\ShortCode\CreateShortCodeContentNegotiationMiddleware;
|
use Shlinkio\Shlink\Rest\Middleware\ShortUrl\CreateShortUrlContentNegotiationMiddleware;
|
||||||
use Zend\Diactoros\Response;
|
use Zend\Diactoros\Response;
|
||||||
use Zend\Diactoros\Response\JsonResponse;
|
use Zend\Diactoros\Response\JsonResponse;
|
||||||
use Zend\Diactoros\ServerRequestFactory;
|
use Zend\Diactoros\ServerRequestFactory;
|
||||||
|
|
||||||
class CreateShortCodeContentNegotiationMiddlewareTest extends TestCase
|
class CreateShortUrlContentNegotiationMiddlewareTest extends TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var CreateShortCodeContentNegotiationMiddleware
|
* @var CreateShortUrlContentNegotiationMiddleware
|
||||||
*/
|
*/
|
||||||
private $middleware;
|
private $middleware;
|
||||||
/**
|
/**
|
||||||
@ -25,7 +25,7 @@ class CreateShortCodeContentNegotiationMiddlewareTest extends TestCase
|
|||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
$this->middleware = new CreateShortCodeContentNegotiationMiddleware();
|
$this->middleware = new CreateShortUrlContentNegotiationMiddleware();
|
||||||
$this->requestHandler = $this->prophesize(RequestHandlerInterface::class);
|
$this->requestHandler = $this->prophesize(RequestHandlerInterface::class);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user