Skip to content

Commit

Permalink
Fix PHCS errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed May 1, 2017
1 parent 8d44dd8 commit e584d48
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Routing/Router.php
Expand Up @@ -15,8 +15,8 @@
namespace Cake\Routing;

use Cake\Core\Configure;
use Cake\Http\ServerRequest;
use Cake\Http\MiddlewareQueue;
use Cake\Http\ServerRequest;
use Cake\Utility\Inflector;
use InvalidArgumentException;
use Psr\Http\Message\ServerRequestInterface;
Expand Down Expand Up @@ -1090,6 +1090,7 @@ public static function getMatchingMiddleware($path)
if ($middleware) {
return new MiddlewareQueue($middleware);
}

return null;
}

Expand Down
7 changes: 6 additions & 1 deletion tests/TestCase/Routing/Middleware/RoutingMiddlewareTest.php
Expand Up @@ -184,10 +184,12 @@ public function testInvokeScopedMiddleware()
Router::scope('/api', function ($routes) {
$routes->registerMiddleware('first', function ($req, $res, $next) {
$this->log[] = 'first';

return $next($req, $res);
});
$routes->registerMiddleware('second', function ($req, $res, $next) {
$this->log[] = 'second';

return $next($req, $res);
});
$routes->connect('/ping', ['controller' => 'Pings']);
Expand All @@ -202,6 +204,7 @@ public function testInvokeScopedMiddleware()
$response = new Response();
$next = function ($req, $res) {
$this->log[] = 'last';

return $res;
};
$middleware = new RoutingMiddleware();
Expand All @@ -221,17 +224,19 @@ public function testInvokeScopedMiddlewareReturnResponse()
Router::scope('/api', function ($routes) {
$routes->registerMiddleware('first', function ($req, $res, $next) {
$this->log[] = 'first';

return $res;
});
$routes->registerMiddleware('second', function ($req, $res, $next) {
$this->log[] = 'second';

return $next($req, $res);
});

$routes->applyMiddleware('second');
$routes->connect('/ping', ['controller' => 'Pings']);

$routes->scope('/v1', function ($routes ) {
$routes->scope('/v1', function ($routes) {
$routes->applyMiddleware('first');
$routes->connect('/articles', ['controller' => 'Articles']);
});
Expand Down

0 comments on commit e584d48

Please sign in to comment.