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

Revert usage of ROUTE_MIDDLEWARE constant in ApplicationFactory #559

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/Container/ApplicationFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@
use Zend\Expressive\Application;
use Zend\Expressive\ApplicationPipeline;
use Zend\Expressive\MiddlewareFactory;
use Zend\Expressive\Router\Middleware\PathBasedRoutingMiddleware;
use Zend\HttpHandlerRunner\RequestHandlerRunner;

use const Zend\Expressive\ROUTE_MIDDLEWARE;

/**
* Create an Application instance.
*
Expand All @@ -36,7 +35,7 @@ public function __invoke(ContainerInterface $container) : Application
return new Application(
$container->get(MiddlewareFactory::class),
$container->get(ApplicationPipeline::class),
$container->get(ROUTE_MIDDLEWARE),
$container->get(PathBasedRoutingMiddleware::class),
$container->get(RequestHandlerRunner::class)
);
}
Expand Down
1 change: 1 addition & 0 deletions src/constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
* Should resolve to the Zend\Expressive\Router\Middleware\PathBasedRoutingMiddleware
* service.
*
* @deprecated To remove in version 4.0.0.
* @var string
*/
const ROUTE_MIDDLEWARE = __NAMESPACE__ . '\Middleware\RouteMiddleware';
Expand Down
4 changes: 1 addition & 3 deletions test/Container/ApplicationFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
use Zend\HttpHandlerRunner\RequestHandlerRunner;
use Zend\Stratigility\MiddlewarePipeInterface;

use const Zend\Expressive\ROUTE_MIDDLEWARE;

class ApplicationFactoryTest extends TestCase
{
public function testFactoryProducesAnApplication()
Expand All @@ -33,7 +31,7 @@ public function testFactoryProducesAnApplication()
$container = $this->prophesize(ContainerInterface::class);
$container->get(MiddlewareFactory::class)->willReturn($middlewareFactory);
$container->get(ApplicationPipeline::class)->willReturn($pipeline);
$container->get(ROUTE_MIDDLEWARE)->willReturn($routeMiddleware);
$container->get(PathBasedRoutingMiddleware::class)->willReturn($routeMiddleware);
$container->get(RequestHandlerRunner::class)->willReturn($runner);

$factory = new ApplicationFactory();
Expand Down