Skip to content

Commit

Permalink
Update yiisoft/middleware-dispatcher version to 5.0 (#185)
Browse files Browse the repository at this point in the history
* Update `yiisoft/middleware-dispatcher` version to 5.0

* Add changelog
  • Loading branch information
rustamwin committed Jan 9, 2023
1 parent 75b086a commit e4aed14
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 18 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Yii Router Change Log

## 2.0.1 under development
## 2.1.0 under development

- no changes in this release.
- Chg #185: Update `yiisoft/middleware-dispatcher` version to `^5.0` (@rustamwin)

## 2.0.0 November 12, 2022

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"psr/http-server-handler": "^1.0",
"psr/http-server-middleware": "^1.0",
"yiisoft/http": "^1.2",
"yiisoft/middleware-dispatcher": "^3.0|^4.0",
"yiisoft/middleware-dispatcher": "^5.0",
"yiisoft/router-implementation": "1.0.0"
},
"require-dev": {
Expand Down
6 changes: 2 additions & 4 deletions tests/GroupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use RuntimeException;
use Yiisoft\Middleware\Dispatcher\MiddlewareDispatcher;
use Yiisoft\Middleware\Dispatcher\MiddlewareFactory;
use Yiisoft\Middleware\Dispatcher\WrapperFactory;
use Yiisoft\Router\Group;
use Yiisoft\Router\Route;
use Yiisoft\Router\RouteCollection;
Expand Down Expand Up @@ -421,7 +420,7 @@ public function testImmutability(): void
{
$container = new SimpleContainer();
$middlewareDispatcher = new MiddlewareDispatcher(
new MiddlewareFactory($container, new WrapperFactory($container)),
new MiddlewareFactory($container),
);

$group = Group::create();
Expand Down Expand Up @@ -449,9 +448,8 @@ public function handle(ServerRequestInterface $request): ResponseInterface
private function getDispatcher(): MiddlewareDispatcher
{
$container = new Container([]);
$wrapperFactory = new WrapperFactory($container);
return new MiddlewareDispatcher(
new MiddlewareFactory($container, $wrapperFactory),
new MiddlewareFactory($container),
$this->createMock(EventDispatcherInterface::class)
);
}
Expand Down
5 changes: 2 additions & 3 deletions tests/MatchingResultTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use Yiisoft\Http\Method;
use Yiisoft\Middleware\Dispatcher\MiddlewareDispatcher;
use Yiisoft\Middleware\Dispatcher\MiddlewareFactory;
use Yiisoft\Middleware\Dispatcher\WrapperFactory;
use Yiisoft\Router\MatchingResult;
use Yiisoft\Router\Route;
use Yiisoft\Test\Support\Container\SimpleContainer;
Expand Down Expand Up @@ -53,7 +52,7 @@ public function testProcessSuccess(): void
{
$container = $this->createMock(ContainerInterface::class);
$dispatcher = new MiddlewareDispatcher(
new MiddlewareFactory($container, new WrapperFactory($container)),
new MiddlewareFactory($container),
$this->createMock(EventDispatcherInterface::class)
);
$route = Route::post('/', $dispatcher)->middleware($this->getMiddleware());
Expand Down Expand Up @@ -87,7 +86,7 @@ public function testImmutability(): void
{
$container = new SimpleContainer();
$middlewareDispatcher = new MiddlewareDispatcher(
new MiddlewareFactory($container, new WrapperFactory($container)),
new MiddlewareFactory($container),
);

$result = MatchingResult::fromFailure([Method::GET]);
Expand Down
3 changes: 1 addition & 2 deletions tests/Middleware/RouterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use Psr\Http\Server\RequestHandlerInterface;
use Yiisoft\Http\Method;
use Yiisoft\Middleware\Dispatcher\MiddlewareFactory;
use Yiisoft\Middleware\Dispatcher\WrapperFactory;
use Yiisoft\Router\CurrentRoute;
use Yiisoft\Router\Group;
use Yiisoft\Router\MatchingResult;
Expand Down Expand Up @@ -199,7 +198,7 @@ private function createRouterMiddleware(
return new Router(
$this->getMatcher($routeCollection),
new Psr17Factory(),
new MiddlewareFactory($container, new WrapperFactory($container)),
new MiddlewareFactory($container),
$currentRoute ?? new CurrentRoute()
);
}
Expand Down
3 changes: 1 addition & 2 deletions tests/RouteCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use RuntimeException;
use Yiisoft\Middleware\Dispatcher\MiddlewareDispatcher;
use Yiisoft\Middleware\Dispatcher\MiddlewareFactory;
use Yiisoft\Middleware\Dispatcher\WrapperFactory;
use Yiisoft\Router\Group;
use Yiisoft\Router\Route;
use Yiisoft\Router\RouteCollection;
Expand Down Expand Up @@ -385,7 +384,7 @@ private function getDispatcher(ContainerInterface $container = null): Middleware
{
$container ??= $this->createMock(ContainerInterface::class);
return new MiddlewareDispatcher(
new MiddlewareFactory($container, new WrapperFactory($container)),
new MiddlewareFactory($container),
$this->createMock(EventDispatcherInterface::class)
);
}
Expand Down
7 changes: 3 additions & 4 deletions tests/RouteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use Yiisoft\Http\Method;
use Yiisoft\Middleware\Dispatcher\MiddlewareDispatcher;
use Yiisoft\Middleware\Dispatcher\MiddlewareFactory;
use Yiisoft\Middleware\Dispatcher\WrapperFactory;
use Yiisoft\Router\Route;
use Yiisoft\Router\Tests\Support\AssertTrait;
use Yiisoft\Router\Tests\Support\Container;
Expand Down Expand Up @@ -402,7 +401,7 @@ public function testImmutability(): void
{
$container = new SimpleContainer();
$middlewareDispatcher = new MiddlewareDispatcher(
new MiddlewareFactory($container, new WrapperFactory($container)),
new MiddlewareFactory($container),
);

$route = Route::get('/');
Expand Down Expand Up @@ -435,13 +434,13 @@ private function getDispatcher(ContainerInterface $container = null): Middleware
{
if ($container === null) {
return new MiddlewareDispatcher(
new MiddlewareFactory($this->getContainer(), new WrapperFactory($this->getContainer())),
new MiddlewareFactory($this->getContainer()),
$this->createMock(EventDispatcherInterface::class)
);
}

return new MiddlewareDispatcher(
new MiddlewareFactory($container, new WrapperFactory($container)),
new MiddlewareFactory($container),
$this->createMock(EventDispatcherInterface::class)
);
}
Expand Down

0 comments on commit e4aed14

Please sign in to comment.