|
14 | 14 | use Psr\Http\Server\RequestHandlerInterface; |
15 | 15 | use RuntimeException; |
16 | 16 | use Slim\Factory\AppFactory; |
17 | | -use Slim\Routing\PipelineOrder; |
18 | 17 | use Slim\Routing\PipelineRunner; |
19 | 18 | use stdClass; |
20 | 19 |
|
@@ -191,58 +190,4 @@ public function testHandleWithInvalidMiddlewareStringThrowsException(): void |
191 | 190 |
|
192 | 191 | $runner->handle($request); |
193 | 192 | } |
194 | | - |
195 | | - public function testHandleExecutesPipelineInLifoOrder(): void |
196 | | - { |
197 | | - $app = AppFactory::create(); |
198 | | - $container = $app->getContainer(); |
199 | | - |
200 | | - $request = $container |
201 | | - ->get(ServerRequestFactoryInterface::class) |
202 | | - ->createServerRequest('GET', '/'); |
203 | | - |
204 | | - $responseFactory = $container->get(ResponseFactoryInterface::class); |
205 | | - |
206 | | - // This middleware will be executed LAST in LIFO mode (because it was added first). |
207 | | - $first = new class implements MiddlewareInterface { |
208 | | - public function process( |
209 | | - ServerRequestInterface $request, |
210 | | - RequestHandlerInterface $handler, |
211 | | - ): ResponseInterface { |
212 | | - $response = $handler->handle($request); |
213 | | - return $response->withHeader('X-Order', 'First'); |
214 | | - } |
215 | | - }; |
216 | | - |
217 | | - // This middleware will be executed FIRST in LIFO mode. |
218 | | - $second = new class implements MiddlewareInterface { |
219 | | - public function process( |
220 | | - ServerRequestInterface $request, |
221 | | - RequestHandlerInterface $handler, |
222 | | - ): ResponseInterface { |
223 | | - $response = $handler->handle($request); |
224 | | - return $response->withHeader('X-Order', 'Second'); |
225 | | - } |
226 | | - }; |
227 | | - |
228 | | - // Final handler that produces a basic response |
229 | | - $finalHandler = fn() => $responseFactory->createResponse(); |
230 | | - |
231 | | - $runner = $container |
232 | | - ->get(PipelineRunner::class) |
233 | | - ->withOrder(PipelineOrder::LIFO) |
234 | | - ->withPipeline( |
235 | | - [ |
236 | | - $finalHandler, // end |
237 | | - $second, // ^ second |
238 | | - $first, // ^ start |
239 | | - ], |
240 | | - ); |
241 | | - |
242 | | - $response = $runner->handle($request); |
243 | | - |
244 | | - $this->assertSame('First', $response->getHeaderLine('X-Order')); |
245 | | - } |
246 | | - |
247 | | - |
248 | 193 | } |
0 commit comments