Skip to content

Commit 4209713

Browse files
committed
zend-expressive-router ^2 usage
1 parent 173fd04 commit 4209713

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ vendor
33
.php_cs.cache
44
coverage.json
55
coverage/
6+
bin/

spec/Middleware/ForceHttpsSpec.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Psr\Http\Message\ResponseInterface;
1010
use Psr\Http\Message\ServerRequestInterface;
1111
use Zend\Diactoros\Uri;
12+
use Zend\Expressive\Router\Route;
1213
use Zend\Expressive\Router\RouterInterface;
1314
use Zend\Expressive\Router\RouteResult;
1415

@@ -69,7 +70,7 @@
6970
it('not redirect on https and match but no strict_transport_security config', function () {
7071

7172
Console::overrideIsConsole(false);
72-
$match = RouteResult::fromRouteMatch('about', 'About', []);
73+
$match = RouteResult::fromRoute(new Route('/about', 'About'));
7374
allow($this->router)->toReceive('match')->andReturn($match);
7475

7576
allow($this->request)->toReceive('getUri', 'getScheme')->andReturn('https');
@@ -85,7 +86,7 @@
8586
it('not redirect on http and match, with force_all_routes is false and matched route name not in force_specific_routes config', function () {
8687

8788
Console::overrideIsConsole(false);
88-
$match = RouteResult::fromRouteMatch('about', 'About', []);
89+
$match = RouteResult::fromRoute(new Route('/about', 'About'));
8990
allow($this->router)->toReceive('match')->andReturn($match);
9091

9192
allow($this->request)->toReceive('getUri', 'getScheme')->andReturn('http');
@@ -112,7 +113,7 @@
112113
it('not redirect on https and match, with strict_transport_security config, but disabled', function () {
113114

114115
Console::overrideIsConsole(false);
115-
$match = RouteResult::fromRouteMatch('about', 'About', []);
116+
$match = RouteResult::fromRoute(new Route('/about', 'About'));
116117
allow($this->router)->toReceive('match')->andReturn($match);
117118

118119
allow($this->request)->toReceive('getUri', 'getScheme')->andReturn('https');
@@ -138,7 +139,7 @@
138139
it('not redirect on https and match, with strict_transport_security config, and enabled', function () {
139140

140141
Console::overrideIsConsole(false);
141-
$match = RouteResult::fromRouteMatch('about', 'About', []);
142+
$match = RouteResult::fromRoute(new Route('/about', 'About'));
142143

143144
allow($this->router)->toReceive('match')->andReturn($match);
144145
allow($this->request)->toReceive('getUri', 'getScheme')->andReturn('https');
@@ -164,7 +165,7 @@
164165
it('return Response with 308 status on http and match', function () {
165166

166167
Console::overrideIsConsole(false);
167-
$match = RouteResult::fromRouteMatch('about', 'About', []);
168+
$match = RouteResult::fromRoute(new Route('/about', 'About'));
168169

169170
allow($this->router)->toReceive('match')->andReturn($match);
170171
allow($this->request)->toReceive('getUri', 'getScheme')->andReturn('http');

0 commit comments

Comments
 (0)