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

Commit

Permalink
Merge branch 'hotfix/application-should-use-route-middleware-service'…
Browse files Browse the repository at this point in the history
… into release-3.0.0

Close #556
  • Loading branch information
weierophinney committed Feb 14, 2018
2 parents bf4a4f8 + d0b451e commit 5f280f2
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 4 deletions.
28 changes: 28 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,34 @@

All notable changes to this project will be documented in this file, in reverse chronological order by release.

## 3.0.0alpha7 - 2018-02-14

### Added

- Nothing.

### Changed

- [#556](https://github.com/zendframework/zend-expressive/pull/556) modifies the
`ApplicationFactory` such that it now uses the
`Zend\Expressive\ROUTE_MIDDLEWARE` constant in order to retrieve the
`Zend\Expressive\Router\Middleware\PathBasedRoutingMiddleware` instance.
This is done to help smooth upgrades from v2 to v3, as it prevents a manual
step when updating the `config/pipeline.php`, and ensures that the instance
composed in the application is the same instance piped to the application.

### Deprecated

- Nothing.

### Removed

- Nothing.

### Fixed

- Nothing.

## 3.0.0alpha6 - 2018-02-14

### Added
Expand Down
5 changes: 3 additions & 2 deletions src/Container/ApplicationFactory.php
Expand Up @@ -13,9 +13,10 @@
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 @@ -35,7 +36,7 @@ public function __invoke(ContainerInterface $container) : Application
return new Application(
$container->get(MiddlewareFactory::class),
$container->get(ApplicationPipeline::class),
$container->get(PathBasedRoutingMiddleware::class),
$container->get(ROUTE_MIDDLEWARE),
$container->get(RequestHandlerRunner::class)
);
}
Expand Down
1 change: 0 additions & 1 deletion src/constants.php
Expand Up @@ -70,7 +70,6 @@
* 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: 3 additions & 1 deletion test/Container/ApplicationFactoryTest.php
Expand Up @@ -19,6 +19,8 @@
use Zend\HttpHandlerRunner\RequestHandlerRunner;
use Zend\Stratigility\MiddlewarePipeInterface;

use const Zend\Expressive\ROUTE_MIDDLEWARE;

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

$factory = new ApplicationFactory();
Expand Down

0 comments on commit 5f280f2

Please sign in to comment.