/** * Test {@link Factory::getControllerDescription} * * @dataProvider controllerNameProvider * @param string $controllerClassName */ public function testGetControllerDescription($controllerClassName) { $description = $this->factory->getControllerDescription($controllerClassName); $this->assertNotNull($description); $this->assertTrue($description instanceof ControllerDescription); $this->assertEquals($controllerClassName, $description->getClassName()); }
/** * Get the list of actions for a controller * * @param string $controllerClassName * @return array */ public static function getActions($controllerClassName) { try { $actions = ServiceManager::getServiceManager()->get('generis/cache')->get(self::CONTROLLER_PREFIX . $controllerClassName); } catch (\common_cache_NotFoundException $e) { $factory = new Factory(); $desc = $factory->getControllerDescription($controllerClassName); $actions = array(); foreach ($desc->getActions() as $action) { $actions[] = $action->getName(); } ServiceManager::getServiceManager()->get('generis/cache')->put($actions, self::CONTROLLER_PREFIX . $controllerClassName); } return $actions; }
/** * Get the list of actions for a controller * * @param unknown $controllerClassName * @return array */ public static function getActions($controllerClassName) { try { $actions = \common_cache_FileCache::singleton()->get(self::CONTROLLER_PREFIX . $controllerClassName); } catch (\common_cache_NotFoundException $e) { $factory = new Factory(); $desc = $factory->getControllerDescription($controllerClassName); $actions = array(); foreach ($desc->getActions() as $action) { $actions[] = $action->getName(); } \common_cache_FileCache::singleton()->put($actions, self::CONTROLLER_PREFIX . $controllerClassName); } return $actions; }