/**
  * Special override to set up the app with controllers that have a dynamic middleware. This is better suited to
  * testing Middleware so that the developer can pass in the middleware and subsequently perform tests on it
  *
  * @param array $env
  * @param array $middlewares
  */
 public function setUpApp($env = array(), $middlewares = array())
 {
     parent::setUpApp($env);
     $this->app->setModelLoaders(array(new \MABI\DirectoryModelLoader(__DIR__ . '/../TestApp/TestModelDir', $this->app, 'mabiTesting')));
     $dirControllerLoader = new \MABI\DirectoryControllerLoader(__DIR__ . '/../TestApp/TestControllerDir', $this->app, 'mabiTesting');
     foreach ($dirControllerLoader->getControllers() as $controller) {
         if (get_class($controller) == 'mabiTesting\\JustAController') {
             $this->controller = $controller;
             if (!empty($middlewares)) {
                 foreach ($middlewares as $middleware) {
                     $this->controller->addMiddleware($middleware);
                 }
                 $this->controller->addMiddleware(new \MABI\Middleware\AnonymousIdentifier());
             }
         }
         if (get_class($controller) == 'mabiTesting\\ModelBController') {
             $this->restController = $controller;
             if (!empty($middlewares)) {
                 foreach ($middlewares as $middleware) {
                     $this->restController->addMiddleware($middleware);
                 }
                 $this->restController->addMiddleware(new \MABI\Middleware\AnonymousIdentifier());
             }
         }
     }
     $this->app->setControllerLoaders(array($dirControllerLoader));
 }