|
10 | 10 | namespace ZendTest\Mvc;
|
11 | 11 |
|
12 | 12 | use Interop\Container\ContainerInterface;
|
13 |
| -use Interop\Http\ServerMiddleware\DelegateInterface; |
14 | 13 | use Interop\Http\ServerMiddleware\MiddlewareInterface;
|
15 | 14 | use PHPUnit\Framework\TestCase;
|
16 | 15 | use Psr\Http\Message\ResponseInterface;
|
@@ -398,76 +397,6 @@ public function testValidMiddlewareDispatchCancelsPreviousDispatchFailures()
|
398 | 397 | self::assertEmpty($event->getError(), 'Previously set MVC errors are canceled by a successful dispatch');
|
399 | 398 | }
|
400 | 399 |
|
401 |
| - /** |
402 |
| - * @dataProvider possibleMiddlewareNonPsr7ResponseReturnValues |
403 |
| - * |
404 |
| - * @param mixed $middlewareResult |
405 |
| - */ |
406 |
| - public function testMiddlewareDispatchWillRetrieveAnyCallableReturnValue($middlewareResult) |
407 |
| - { |
408 |
| - $middlewareName = uniqid('middleware', true); |
409 |
| - $routeMatch = new RouteMatch(['middleware' => $middlewareName]); |
410 |
| - /* @var $application Application|\PHPUnit_Framework_MockObject_MockObject */ |
411 |
| - $application = $this->createMock(Application::class); |
412 |
| - $eventManager = new EventManager(); |
413 |
| - $middleware = $this->getMockBuilder(\stdClass::class)->setMethods(['__invoke'])->getMock(); |
414 |
| - $serviceManager = new ServiceManager([ |
415 |
| - 'factories' => [ |
416 |
| - 'EventManager' => function () { |
417 |
| - return new EventManager(); |
418 |
| - }, |
419 |
| - ], |
420 |
| - 'services' => [ |
421 |
| - $middlewareName => $middleware, |
422 |
| - ], |
423 |
| - ]); |
424 |
| - |
425 |
| - $application->expects(self::any())->method('getRequest')->willReturn(new Request()); |
426 |
| - $application->expects(self::any())->method('getEventManager')->willReturn($eventManager); |
427 |
| - $application->expects(self::any())->method('getServiceManager')->willReturn($serviceManager); |
428 |
| - $application->expects(self::any())->method('getResponse')->willReturn(new Response()); |
429 |
| - $middleware->expects(self::once())->method('__invoke')->willReturn($middlewareResult); |
430 |
| - |
431 |
| - $eventManager->attach(MvcEvent::EVENT_DISPATCH_ERROR, function ($e) { |
432 |
| - self::fail('No dispatch error should have been raised'); |
433 |
| - }); |
434 |
| - |
435 |
| - $event = new MvcEvent(); |
436 |
| - |
437 |
| - $event->setRequest(new Request()); |
438 |
| - $event->setApplication($application); |
439 |
| - $event->setError(Application::ERROR_CONTROLLER_CANNOT_DISPATCH); |
440 |
| - $event->setRouteMatch($routeMatch); |
441 |
| - |
442 |
| - $listener = new MiddlewareListener(); |
443 |
| - $result = $listener->onDispatch($event); |
444 |
| - |
445 |
| - self::assertSame($middlewareResult, $result); |
446 |
| - self::assertSame($middlewareResult, $event->getResult()); |
447 |
| - self::assertEmpty($event->getError(), 'No errors raised when the return type is unknown'); |
448 |
| - } |
449 |
| - |
450 |
| - /** |
451 |
| - * @return mixed[][] |
452 |
| - */ |
453 |
| - public function possibleMiddlewareNonPsr7ResponseReturnValues() |
454 |
| - { |
455 |
| - return [ |
456 |
| - [123], |
457 |
| - [true], |
458 |
| - [false], |
459 |
| - [[]], |
460 |
| - [new \stdClass()], |
461 |
| - [$this], |
462 |
| - [$this->createMock(ModelInterface::class)], |
463 |
| - [$this->createMock(Response::class)], |
464 |
| - [['view model data' => 'as an array']], |
465 |
| - [['foo' => new \stdClass()]], |
466 |
| - ['a response string'], |
467 |
| - ]; |
468 |
| - } |
469 |
| - |
470 |
| - |
471 | 400 | public function testValidMiddlewareFiresDispatchableInterfaceEventListeners()
|
472 | 401 | {
|
473 | 402 | $middlewareName = uniqid('middleware', true);
|
|
0 commit comments