Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
xepozz committed Jun 14, 2024
1 parent 2c7b01b commit 0ef8f0c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/Unit/Debug/Provider/DebugApiProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use PHPUnit\Framework\TestCase;
use Psr\Container\ContainerInterface;
use Yiisoft\Router\RouteCollectorInterface;
use Yiisoft\Yii\Debug\Api\Debug\Http\RouteCollectorWrapper;
use Yiisoft\Yii\Debug\Api\Debug\Middleware\DebugHeaders;
use Yiisoft\Yii\Debug\Api\Debug\Provider\DebugApiProvider;

Expand All @@ -26,11 +27,18 @@ public function testExtension(): void
$routeCollectorDecorator = $extensions[RouteCollectorInterface::class];
$this->assertIsCallable($routeCollectorDecorator);

$middlewares = [DebugHeaders::class];

$container = $this->createMock(ContainerInterface::class);
$container->expects($this->once())
->method('get')
->with(RouteCollectorWrapper::class)
->willReturn(new RouteCollectorWrapper($middlewares));

$routeCollector = $this->createMock(RouteCollectorInterface::class);
$routeCollector->expects($this->once())
->method('prependMiddleware')
->with(DebugHeaders::class)
->with(...$middlewares)
->willReturn($routeCollector);

$this->assertSame($routeCollector, $routeCollectorDecorator($container, $routeCollector));
Expand Down

0 comments on commit 0ef8f0c

Please sign in to comment.