Closed weierophinney closed 6 years ago
This patch is now ready for review.
I didn't check tests, but coveralls report shows very poor ImplicitHeadMiddleware coverage
There's something wrong with that report, I think. The testInvokesHandlerWhenRouteImplicitlySupportsHeadAndSupportsGet()
method definitely exercises the lines marked as not covered via its own lines 141-151.
@weierophinney
There's something wrong with that report, I think.
Checked with breakpoint, and no. The report is fine. We never stop there. What's more please note that variable defined in line 99: https://github.com/zendframework/zend-expressive-router/pull/55/files#diff-0c5f0c3fd11973365a718e7fe2685c81R99
is not used ! So definitely there is something wrong.
@weierophinney
The
testInvokesHandlerWhenRouteImplicitlySupportsHeadAndSupportsGet()
method definitely exercises ...
again - checked with debugger and it quits in line 92 of the middleware:
$route = $result->getMatchedRoute();
if (! $route || ! $route->implicitHead()) { // <!-- this condition is satisfied
return $handler->{HANDLER_METHOD}($request);
}
Refactored the test, and fixed a bug in the middleware; let's see what coverage says now! :)
Per the Expressive 2.2. roadmap, this patch imports the
ImplicitHeadMiddleware
andImplicitOptionsMiddleware
from zend-expressive v2, and places them in theZend\Expressive\Router\Middleware
namespace. They have been updated to allow compatibility with any version of http-interop middleware, via the webimpress/http-middleware-compatibility package (which was already a requirement).This patch updates
ImplicitHeadMiddleware
to optionally allow passing a second argument representing a PHP callable capable of producing a PSR-7StreamInterface
instance.Finally, it deprecates the
implicitHead()
andimplicitOptions()
methods of theRoute
class, as they are removed in version 3.