public function testMountInvalidCollectionConnect() { $app = $this->getApp(); $route = new Route('/'); $controllers = $this->getMockControllerCollection(['connect', 'mount'], $route); $controllers->expects($this->never())->method('mount'); $this->setExpectedException('LogicException', 'The method "Bolt\\Tests\\Events\\ControllerMock::connect" must return a "ControllerCollection" instance. Got: "Bolt\\Tests\\Events\\ClippyKoala"'); $mountEvent = new MountEvent($app, $controllers); $mountEvent->mount('/', new ControllerMock($route)); }
/** * Mounts the controllers defined in registerControllers(). * * @param MountEvent $event * * @internal */ public final function onMountControllers(MountEvent $event) { foreach ($this->registerFrontendControllers() as $prefix => $collection) { $event->mount($prefix, $collection); } $app = $this->getContainer(); $backendPrefix = $app['controller.backend.mount_prefix']; foreach ($this->registerBackendControllers() as $prefix => $collection) { $event->mount($backendPrefix . '/' . ltrim($prefix, '/'), $collection); } }
/** * Mounts the routes defined in registerFrontendRoutes() and registerBackendRoutes(). * * @param MountEvent $event * * @internal */ public final function onMountRoutes(MountEvent $event) { $app = $this->getContainer(); $collection = $app['controllers_factory']; if ($collection instanceof DefaultControllerClassAwareInterface) { $collection->setDefaultControllerClass($this); } $this->registerFrontendRoutes($collection); $event->mount('/', $collection); $collection = $app['controllers_factory']; if ($collection instanceof DefaultControllerClassAwareInterface) { $collection->setDefaultControllerClass($this); } $this->registerBackendRoutes($collection); $event->mount($app['controller.backend.mount_prefix'], $collection); }
public function onMountBackend(MountEvent $event) { $app = $event->getApp(); // Mount the standard collection of backend and controllers $prefix = $app['controller.backend.mount_prefix']; $backendKeys = ['authentication', 'database', 'file_manager', 'general', 'log', 'records', 'users']; foreach ($backendKeys as $controller) { $event->mount($prefix, $app['controller.backend.' . $controller]); } // Mount the Async controllers $prefix = $app['controller.async.mount_prefix']; $asyncKeys = ['general', 'filesystem_manager', 'records', 'stack', 'system_checks', 'widget']; foreach ($asyncKeys as $controller) { $event->mount($prefix, $app['controller.async.' . $controller]); } // Mount the Extend controller $prefix = $app['controller.backend.extend.mount_prefix']; $event->mount($prefix, $app['controller.backend.extend']); // Mount the Upload controller $prefix = $app['controller.backend.upload.mount_prefix']; $event->mount($prefix, $app['controller.backend.upload']); // Mount the 'thumbnail' provider on /thumbs. $event->mount('/thumbs', new ThumbnailProvider()); }