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

Commit ff8392a

Browse files
committed
Revert unwanted merge changes
This patch reverts unwanted changes that occurred when merging the 2.2 release branch to the 3.0 release branch. Primarily, these are related to artifacts no longer needed in 3.0, such as testing for deprecations.
1 parent c7a1689 commit ff8392a

File tree

8 files changed

+43
-63
lines changed

8 files changed

+43
-63
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ install:
4343
- if [[ $DEPS == 'latest' ]]; then travis_retry composer update $COMPOSER_ARGS ; fi
4444
- if [[ $DEPS == 'lowest' ]]; then travis_retry composer update --prefer-lowest --prefer-stable $COMPOSER_ARGS ; fi
4545
- if [[ $TEST_COVERAGE == 'true' ]]; then travis_retry composer require --dev $COMPOSER_ARGS $COVERAGE_DEPS ; fi
46-
- if [[ $TEST_COVERAGE == 'true' ]]; then cp phpunit.xml.dist-coverage phpunit.xml.dist ; fi
4746
- stty cols 120 && composer show
4847
- cat phpunit.xml.dist
4948

phpcs.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,4 @@
55
<!-- Paths to check -->
66
<file>src</file>
77
<file>test</file>
8-
9-
<rule ref="PSR1.Files.SideEffects">
10-
<exclude-pattern>src/AppFactory.php</exclude-pattern>
11-
</rule>
128
</ruleset>

phpunit.xml.dist-coverage

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/Container/ApplicationConfigInjectionDelegator.php

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ public function __invoke(ContainerInterface $container, string $serviceName, cal
6161
* Inspects the configuration provided to determine if a middleware pipeline
6262
* exists to inject in the application.
6363
*
64-
* If no pipeline is defined, but routes *are*, then the method will inject
65-
* the routing and dispatch middleware.
66-
*
6764
* Use the following configuration format:
6865
*
6966
* <code>
@@ -129,7 +126,38 @@ public static function injectPipelineFromConfig(Application $application, array
129126
/**
130127
* Inject routes from configuration.
131128
*
132-
* Proxies to ApplicationConfigInjectionDelegator::injectRoutesFromConfig
129+
* Introspects the provided configuration for routes to inject in the
130+
* application instance.
131+
*
132+
* The following configuration structure can be used to define routes:
133+
*
134+
* <code>
135+
* return [
136+
* 'routes' => [
137+
* [
138+
* 'path' => '/path/to/match',
139+
* 'middleware' => 'Middleware Service Name or Callable',
140+
* 'allowed_methods' => ['GET', 'POST', 'PATCH'],
141+
* 'options' => [
142+
* 'stuff' => 'to',
143+
* 'pass' => 'to',
144+
* 'the' => 'underlying router',
145+
* ],
146+
* ],
147+
* // etc.
148+
* ],
149+
* ];
150+
* </code>
151+
*
152+
* Each route MUST have a path and middleware key at the minimum.
153+
*
154+
* The "allowed_methods" key may be omitted, can be either an array or the
155+
* value of the Zend\Expressive\Router\Route::HTTP_METHOD_ANY constant; any
156+
* valid HTTP method token is allowed, which means you can specify custom HTTP
157+
* methods as well.
158+
*
159+
* The "options" key may also be omitted, and its interpretation will be
160+
* dependent on the underlying router used.
133161
*
134162
* @throws InvalidArgumentException
135163
*/
@@ -144,7 +172,7 @@ public static function injectRoutesFromConfig(Application $application, array $c
144172
continue;
145173
}
146174

147-
$methods = null;
175+
$methods = Route::HTTP_METHOD_ANY;
148176
if (isset($spec['allowed_methods'])) {
149177
$methods = $spec['allowed_methods'];
150178
if (! is_array($methods)) {

test/ConfigProviderTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,17 @@ public function testProviderDefinesExpectedFactoryServices()
6363
$factories = $config['factories'];
6464

6565
$this->assertArrayHasKey(Application::class, $factories);
66+
$this->assertArrayHasKey(ApplicationPipeline::class, $factories);
67+
$this->assertArrayHasKey(EmitterInterface::class, $factories);
6668
$this->assertArrayHasKey(ErrorHandler::class, $factories);
69+
$this->assertArrayHasKey(MiddlewareContainer::class, $factories);
70+
$this->assertArrayHasKey(MiddlewareFactory::class, $factories);
6771
$this->assertArrayHasKey(Middleware\ErrorResponseGenerator::class, $factories);
6872
$this->assertArrayHasKey(NotFoundHandler::class, $factories);
73+
$this->assertArrayHasKey(RequestHandlerRunner::class, $factories);
6974
$this->assertArrayHasKey(ResponseInterface::class, $factories);
75+
$this->assertArrayHasKey(ServerRequestInterface::class, $factories);
76+
$this->assertArrayHasKey(ServerRequestErrorResponseGenerator::class, $factories);
7077
$this->assertArrayHasKey(StreamInterface::class, $factories);
7178
}
7279

test/Container/ApplicationConfigInjectionDelegatorTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
use Zend\HttpHandlerRunner\RequestHandlerRunner;
3232
use Zend\Stratigility\MiddlewarePipe;
3333
use ZendTest\Expressive\ContainerTrait;
34-
use ZendTest\Expressive\TestAsset\CallableInteropMiddleware;
3534
use ZendTest\Expressive\TestAsset\InvokableMiddleware;
3635

3736
class ApplicationConfigInjectionDelegatorTest extends TestCase
@@ -200,12 +199,12 @@ public static function assertMethodNotAllowedMiddleware(MiddlewareInterface $mid
200199
public function callableMiddlewares()
201200
{
202201
return [
203-
[CallableInteropMiddleware::class],
202+
['HelloWorld'],
204203
[
205-
function ($request, DelegateInterface $delegate) {
204+
function () {
206205
},
207206
],
208-
[[CallableInteropMiddleware::class, 'staticallyCallableMiddleware']],
207+
[[InvokableMiddleware::class, 'staticallyCallableMiddleware']],
209208
];
210209
}
211210

test/Router/IntegrationTest.php

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -59,31 +59,6 @@ public function setUp()
5959
};
6060
$this->router = $this->prophesize(RouterInterface::class);
6161
$this->container = $this->mockContainerInterface();
62-
$this->disregardDeprecationNotices();
63-
}
64-
65-
public function tearDown()
66-
{
67-
restore_error_handler();
68-
}
69-
70-
public function disregardDeprecationNotices()
71-
{
72-
set_error_handler(function ($errno, $errstr) {
73-
if (strstr($errstr, 'pipe() the middleware directly')) {
74-
return true;
75-
}
76-
if (strstr($errstr, 'doublePassMiddleware()')) {
77-
return true;
78-
}
79-
if (strstr($errstr, 'ImplicitHeadMiddleware is deprecated')) {
80-
return true;
81-
}
82-
if (strstr($errstr, 'ImplicitOptionsMiddleware is deprecated')) {
83-
return true;
84-
}
85-
return false;
86-
}, E_USER_DEPRECATED);
8762
}
8863

8964
public function getApplication()

test/TestAsset/CallableInteropMiddleware.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,4 @@ public function __invoke(ServerRequestInterface $request, RequestHandlerInterfac
2020

2121
return $response->withHeader('X-Callable-Interop-Middleware', __CLASS__);
2222
}
23-
24-
public static function staticallyCallableMiddleware(ServerRequestInterface $request, DelegateInterface $delegate)
25-
{
26-
$response = $delegate->process($request);
27-
return $response->withHeader('X-Invoked', __CLASS__);
28-
}
2923
}

0 commit comments

Comments
 (0)