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/revert-unwanted-merge-changes' into develop
Browse files Browse the repository at this point in the history
Ready for 3.0.0rc4.
  • Loading branch information
weierophinney committed Mar 13, 2018
2 parents c7a1689 + 9a643db commit b6c79d8
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 63 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ install:
- if [[ $DEPS == 'latest' ]]; then travis_retry composer update $COMPOSER_ARGS ; fi
- if [[ $DEPS == 'lowest' ]]; then travis_retry composer update --prefer-lowest --prefer-stable $COMPOSER_ARGS ; fi
- if [[ $TEST_COVERAGE == 'true' ]]; then travis_retry composer require --dev $COMPOSER_ARGS $COVERAGE_DEPS ; fi
- if [[ $TEST_COVERAGE == 'true' ]]; then cp phpunit.xml.dist-coverage phpunit.xml.dist ; fi
- stty cols 120 && composer show
- cat phpunit.xml.dist

Expand Down
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
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.0rc4 - 2018-03-13

### Added

- Nothing.

### Changed

- Forward ports a change made in [#581](https://github.com/zendframework/zend-expressive/pull/581)
to how the `ApplicationConfigInjectionDelegator::injectPipelineFromConfig()`
method works. Previously, it would auto-inject routing and dispatch middleware
if routes were configured, but no `middleware_pipeline` was present.
Considering that this method will always be called manually, this
functionality was removed; the method now becomes a no-op if no
`middleware_pipeline` is present.

### Deprecated

- Nothing.

### Removed

- Nothing.

### Fixed

- Nothing.

## 3.0.0rc3 - 2018-03-07

### Added
Expand Down
4 changes: 0 additions & 4 deletions phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,4 @@
<!-- Paths to check -->
<file>src</file>
<file>test</file>

<rule ref="PSR1.Files.SideEffects">
<exclude-pattern>src/AppFactory.php</exclude-pattern>
</rule>
</ruleset>
18 changes: 0 additions & 18 deletions phpunit.xml.dist-coverage

This file was deleted.

38 changes: 33 additions & 5 deletions src/Container/ApplicationConfigInjectionDelegator.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ public function __invoke(ContainerInterface $container, string $serviceName, cal
* Inspects the configuration provided to determine if a middleware pipeline
* exists to inject in the application.
*
* If no pipeline is defined, but routes *are*, then the method will inject
* the routing and dispatch middleware.
*
* Use the following configuration format:
*
* <code>
Expand Down Expand Up @@ -129,7 +126,38 @@ public static function injectPipelineFromConfig(Application $application, array
/**
* Inject routes from configuration.
*
* Proxies to ApplicationConfigInjectionDelegator::injectRoutesFromConfig
* Introspects the provided configuration for routes to inject in the
* application instance.
*
* The following configuration structure can be used to define routes:
*
* <code>
* return [
* 'routes' => [
* [
* 'path' => '/path/to/match',
* 'middleware' => 'Middleware Service Name or Callable',
* 'allowed_methods' => ['GET', 'POST', 'PATCH'],
* 'options' => [
* 'stuff' => 'to',
* 'pass' => 'to',
* 'the' => 'underlying router',
* ],
* ],
* // etc.
* ],
* ];
* </code>
*
* Each route MUST have a path and middleware key at the minimum.
*
* The "allowed_methods" key may be omitted, can be either an array or the
* value of the Zend\Expressive\Router\Route::HTTP_METHOD_ANY constant; any
* valid HTTP method token is allowed, which means you can specify custom HTTP
* methods as well.
*
* The "options" key may also be omitted, and its interpretation will be
* dependent on the underlying router used.
*
* @throws InvalidArgumentException
*/
Expand All @@ -144,7 +172,7 @@ public static function injectRoutesFromConfig(Application $application, array $c
continue;
}

$methods = null;
$methods = Route::HTTP_METHOD_ANY;
if (isset($spec['allowed_methods'])) {
$methods = $spec['allowed_methods'];
if (! is_array($methods)) {
Expand Down
7 changes: 7 additions & 0 deletions test/ConfigProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,17 @@ public function testProviderDefinesExpectedFactoryServices()
$factories = $config['factories'];

$this->assertArrayHasKey(Application::class, $factories);
$this->assertArrayHasKey(ApplicationPipeline::class, $factories);
$this->assertArrayHasKey(EmitterInterface::class, $factories);
$this->assertArrayHasKey(ErrorHandler::class, $factories);
$this->assertArrayHasKey(MiddlewareContainer::class, $factories);
$this->assertArrayHasKey(MiddlewareFactory::class, $factories);
$this->assertArrayHasKey(Middleware\ErrorResponseGenerator::class, $factories);
$this->assertArrayHasKey(NotFoundHandler::class, $factories);
$this->assertArrayHasKey(RequestHandlerRunner::class, $factories);
$this->assertArrayHasKey(ResponseInterface::class, $factories);
$this->assertArrayHasKey(ServerRequestInterface::class, $factories);
$this->assertArrayHasKey(ServerRequestErrorResponseGenerator::class, $factories);
$this->assertArrayHasKey(StreamInterface::class, $factories);
}

Expand Down
7 changes: 3 additions & 4 deletions test/Container/ApplicationConfigInjectionDelegatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
use Zend\HttpHandlerRunner\RequestHandlerRunner;
use Zend\Stratigility\MiddlewarePipe;
use ZendTest\Expressive\ContainerTrait;
use ZendTest\Expressive\TestAsset\CallableInteropMiddleware;
use ZendTest\Expressive\TestAsset\InvokableMiddleware;

class ApplicationConfigInjectionDelegatorTest extends TestCase
Expand Down Expand Up @@ -200,12 +199,12 @@ public static function assertMethodNotAllowedMiddleware(MiddlewareInterface $mid
public function callableMiddlewares()
{
return [
[CallableInteropMiddleware::class],
['HelloWorld'],
[
function ($request, DelegateInterface $delegate) {
function () {
},
],
[[CallableInteropMiddleware::class, 'staticallyCallableMiddleware']],
[[InvokableMiddleware::class, 'staticallyCallableMiddleware']],
];
}

Expand Down
25 changes: 0 additions & 25 deletions test/Router/IntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,31 +59,6 @@ public function setUp()
};
$this->router = $this->prophesize(RouterInterface::class);
$this->container = $this->mockContainerInterface();
$this->disregardDeprecationNotices();
}

public function tearDown()
{
restore_error_handler();
}

public function disregardDeprecationNotices()
{
set_error_handler(function ($errno, $errstr) {
if (strstr($errstr, 'pipe() the middleware directly')) {
return true;
}
if (strstr($errstr, 'doublePassMiddleware()')) {
return true;
}
if (strstr($errstr, 'ImplicitHeadMiddleware is deprecated')) {
return true;
}
if (strstr($errstr, 'ImplicitOptionsMiddleware is deprecated')) {
return true;
}
return false;
}, E_USER_DEPRECATED);
}

public function getApplication()
Expand Down
6 changes: 0 additions & 6 deletions test/TestAsset/CallableInteropMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,4 @@ public function __invoke(ServerRequestInterface $request, RequestHandlerInterfac

return $response->withHeader('X-Callable-Interop-Middleware', __CLASS__);
}

public static function staticallyCallableMiddleware(ServerRequestInterface $request, DelegateInterface $delegate)
{
$response = $delegate->process($request);
return $response->withHeader('X-Invoked', __CLASS__);
}
}

0 comments on commit b6c79d8

Please sign in to comment.