Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Fixed invalid test setup in NextTest
Browse files Browse the repository at this point in the history
The test testMiddlewareCallingNextWithRequestPassesRequestToNextMiddleware
was using path segregated routes, but they were not pertinent to the
behavior being tested, and, in fact, broke once we fixed the behavior
reported in #165. The equivalent version 3 tests do not use path
segregated routes, so the path segregation was removed in order to
test the expected behavior correctly.
  • Loading branch information
weierophinney committed Apr 4, 2018
1 parent 600e738 commit a96bd88
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions test/NextTest.php
Expand Up @@ -25,6 +25,10 @@
use Zend\Stratigility\Next;
use Zend\Stratigility\Route;

use const Webimpress\HttpMiddlewareCompatibility\HANDLER_METHOD;

use function Zend\Stratigility\middleware;

class NextTest extends TestCase
{
protected $errorHandler;
Expand Down Expand Up @@ -89,18 +93,16 @@ public function testMiddlewareCallingNextWithRequestPassesRequestToNextMiddlewar
$cannedRequest = clone $request;
$cannedRequest = $cannedRequest->withMethod('POST');

$route1 = new Route('/foo/bar', $this->decorateCallableMiddleware(
$route1 = new Route('/', $this->decorateCallableMiddleware(
function ($req, $res, $next) use ($cannedRequest) {
return $next($cannedRequest, $res);
},
'/foo/bar'
}
));
$route2 = new Route('/foo/bar/baz', $this->decorateCallableMiddleware(
$route2 = new Route('/', $this->decorateCallableMiddleware(
function ($req, $res, $next) use ($cannedRequest) {
$this->assertEquals($cannedRequest->getMethod(), $req->getMethod());
return $res;
},
'/foo/bar/baz'
}
));

$this->queue->enqueue($route1);
Expand Down

0 comments on commit a96bd88

Please sign in to comment.