Exemplo n.º 1
0
 /**
  * Ensure that exists an dispatcher middleware.
  *
  * @throws InvalidArgumentException
  */
 protected function ensureEventDispatcherMiddleware()
 {
     if ($this->dispatcherMiddleware !== null) {
         return;
     }
     foreach ($this->middlewares as $priority => $collection) {
         foreach ($collection as $middleware) {
             if ($middleware instanceof EventDispatcherMiddleware) {
                 $this->dispatcherMiddleware = $middleware;
                 return;
             }
         }
     }
     throw NotFoundException::middlewareOfType(EventDispatcherMiddleware::class);
 }
Exemplo n.º 2
0
 /**
  * Test middlewareOfType method.
  */
 public function testMiddlewareOfType()
 {
     $this->given($exception = NotFoundException::middlewareOfType('bar'))->then()->variable($exception->getPrevious())->isNull();
 }