Skip to content

Commit

Permalink
Improve ExtraPathRedirectMiddlewareTest
Browse files Browse the repository at this point in the history
  • Loading branch information
acelaya committed Nov 14, 2024
1 parent 51d8388 commit 5385a1a
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Laminas\Diactoros\Uri;
use Mezzio\Router\Route;
use Mezzio\Router\RouteResult;
use PHPUnit\Framework\Assert;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\MockObject\MockObject;
Expand All @@ -27,6 +28,7 @@
use Shlinkio\Shlink\Core\Util\RedirectResponseHelperInterface;
use Shlinkio\Shlink\Core\Visit\RequestTrackerInterface;

use Shlinkio\Shlink\IpGeolocation\Model\Location;
use function Laminas\Stratigility\middleware;
use function str_starts_with;

Expand Down Expand Up @@ -153,7 +155,10 @@ function () use ($shortUrl, &$currentIteration, $expectedResolveCalls): ShortUrl
);
$this->redirectionBuilder->expects($this->once())->method('buildShortUrlRedirect')->with(
$shortUrl,
$this->isInstanceOf(ServerRequestInterface::class),
$this->callback(function (ServerRequestInterface $req) {
Assert::assertArrayHasKey(Location::class, $req->getAttributes());
return true;
}),
$expectedExtraPath,
)->willReturn('the_built_long_url');
$this->redirectResponseHelper->expects($this->once())->method('buildRedirectResponse')->with(
Expand Down

0 comments on commit 5385a1a

Please sign in to comment.