From 510b34a4eef1ecbd65009e39949efe048556d878 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Fri, 26 Nov 2021 19:20:30 +0300 Subject: [PATCH 1/2] Adopt to DI changes --- tests/GroupTest.php | 5 ++++- tests/RouteTest.php | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/GroupTest.php b/tests/GroupTest.php index 932dedbc..0d0156f5 100644 --- a/tests/GroupTest.php +++ b/tests/GroupTest.php @@ -12,6 +12,7 @@ use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\RequestHandlerInterface; +use Yiisoft\Di\ContainerConfig; use Yiisoft\Middleware\Dispatcher\MiddlewareDispatcher; use Yiisoft\Middleware\Dispatcher\MiddlewareFactory; use Yiisoft\Router\Group; @@ -301,7 +302,9 @@ private function getDispatcher(): MiddlewareDispatcher private function getContainer(array $instances = []): ContainerInterface { - return new Container($instances); + $config = ContainerConfig::create() + ->withDefinitions($instances); + return new Container($config); } private function assertAllRoutesAndGroupsHaveDispatcher(array $items): void diff --git a/tests/RouteTest.php b/tests/RouteTest.php index fa389ee9..3a7cc42a 100644 --- a/tests/RouteTest.php +++ b/tests/RouteTest.php @@ -12,6 +12,7 @@ use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\RequestHandlerInterface; +use Yiisoft\Di\ContainerConfig; use Yiisoft\Http\Method; use Yiisoft\Middleware\Dispatcher\MiddlewareDispatcher; use Yiisoft\Middleware\Dispatcher\MiddlewareFactory; @@ -179,6 +180,8 @@ private function getDispatcher(ContainerInterface $container = null): Middleware private function getContainer(array $instances = []): ContainerInterface { - return new Container($instances); + $config = ContainerConfig::create() + ->withDefinitions($instances); + return new Container($config); } } From 91499ab3400a5d2dc1fd6fed7892ee03c463b572 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Fri, 26 Nov 2021 22:50:14 +0300 Subject: [PATCH 2/2] Fix tests --- tests/GroupTest.php | 5 +---- tests/RouteTest.php | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/tests/GroupTest.php b/tests/GroupTest.php index 0d0156f5..932dedbc 100644 --- a/tests/GroupTest.php +++ b/tests/GroupTest.php @@ -12,7 +12,6 @@ use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\RequestHandlerInterface; -use Yiisoft\Di\ContainerConfig; use Yiisoft\Middleware\Dispatcher\MiddlewareDispatcher; use Yiisoft\Middleware\Dispatcher\MiddlewareFactory; use Yiisoft\Router\Group; @@ -302,9 +301,7 @@ private function getDispatcher(): MiddlewareDispatcher private function getContainer(array $instances = []): ContainerInterface { - $config = ContainerConfig::create() - ->withDefinitions($instances); - return new Container($config); + return new Container($instances); } private function assertAllRoutesAndGroupsHaveDispatcher(array $items): void diff --git a/tests/RouteTest.php b/tests/RouteTest.php index 3a7cc42a..fa389ee9 100644 --- a/tests/RouteTest.php +++ b/tests/RouteTest.php @@ -12,7 +12,6 @@ use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\RequestHandlerInterface; -use Yiisoft\Di\ContainerConfig; use Yiisoft\Http\Method; use Yiisoft\Middleware\Dispatcher\MiddlewareDispatcher; use Yiisoft\Middleware\Dispatcher\MiddlewareFactory; @@ -180,8 +179,6 @@ private function getDispatcher(ContainerInterface $container = null): Middleware private function getContainer(array $instances = []): ContainerInterface { - $config = ContainerConfig::create() - ->withDefinitions($instances); - return new Container($config); + return new Container($instances); } }