Defined new options for new redirect configuration

This commit is contained in:
Alejandro Celaya
2019-11-02 17:23:21 +01:00
parent 8b9663aea0
commit 24c3a3e84c
9 changed files with 85 additions and 58 deletions

View File

@@ -25,20 +25,20 @@ class RedirectActionTest extends TestCase
private $urlShortener;
/** @var ObjectProphecy */
private $visitTracker;
/** @var Options\NotFoundShortUrlOptions */
private $notFoundOptions;
/** @var Options\NotFoundRedirectOptions */
private $redirectOptions;
public function setUp(): void
{
$this->urlShortener = $this->prophesize(UrlShortener::class);
$this->visitTracker = $this->prophesize(VisitsTracker::class);
$this->notFoundOptions = new Options\NotFoundShortUrlOptions();
$this->redirectOptions = new Options\NotFoundRedirectOptions();
$this->action = new RedirectAction(
$this->urlShortener->reveal(),
$this->visitTracker->reveal(),
new Options\AppOptions(['disableTrackParam' => 'foobar']),
$this->notFoundOptions
$this->redirectOptions
);
}
@@ -89,8 +89,7 @@ class RedirectActionTest extends TestCase
$handler = $this->prophesize(RequestHandlerInterface::class);
$handle = $handler->handle(Argument::any())->willReturn(new Response());
$this->notFoundOptions->enableRedirection = true;
$this->notFoundOptions->redirectTo = 'https://shlink.io';
$this->redirectOptions->invalidShortUrl = 'https://shlink.io';
$request = (new ServerRequest())->withAttribute('shortCode', $shortCode);
$resp = $this->action->process($request, $handler->reveal());