Exemplo n.º 1
0
 /**
  * @test
  */
 public function beforeExecuteResponderMiddlewareWillBeCalledBeforeResponderExecutorMiddleware()
 {
     $expectedOrder = ['beforeExecuteResponder', 'executeResponder'];
     $order = [];
     $this->actionResolverMiddleware->expects($this->any())->method('__invoke')->will($this->returnCallback($this->createTestMiddleware()));
     $this->actionExecutorMiddleware->expects($this->any())->method('__invoke')->will($this->returnCallback($this->createTestMiddleware()));
     $this->responderResolverMiddleware->expects($this->any())->method('__invoke')->will($this->returnCallback($this->createTestMiddleware()));
     $beforeExecuteResponderMiddleware = $this->createTestMiddleware(function () use(&$order) {
         $order[] = 'beforeExecuteResponder';
     });
     $responderExecutorMiddlewareStub = $this->createTestMiddleware(function () use(&$order) {
         $order[] = 'executeResponder';
     });
     $this->responderExecutorMiddleware->expects($this->any())->method('__invoke')->will($this->returnCallback($responderExecutorMiddlewareStub));
     $middleware = $this->getMockedAdroitMiddleware();
     $middleware->beforeExecuteResponder($beforeExecuteResponderMiddleware);
     $middleware->__invoke($this->request, $this->response);
     $this->assertEquals($order, $expectedOrder);
 }
 /**
  * @test
  * @expectedException \bitExpert\Adroit\Action\Executor\ActionExecutionException
  */
 public function throwsExceptionIfActionIsNotCallable()
 {
     $action = 'notCallable';
     $request = $this->request->withAttribute(self::$actionAttribute, $action);
     $this->middleware->__invoke($request, $this->response);
 }