/** * Test ModuleRefreshCommand */ public function testModuleRefreshCommand() { $moduleManagement = new ModuleManagement(); $moduleManagement->updateModules(); $module = ModuleQuery::create()->filterByType(1)->orderByPosition(Criteria::DESC)->findOne(); if ($module !== null) { $module->delete(); $application = new Application($this->getKernel()); $moduleRefresh = new ModuleRefreshCommand(); $moduleRefresh->setContainer($this->getContainer()); $application->add($moduleRefresh); $command = $application->find('module:refresh'); $commandTester = new CommandTester($command); $commandTester->execute(['command' => $command->getName()]); $expected = $module; $actual = ModuleQuery::create()->filterByType(1)->orderByPosition(Criteria::DESC)->findOne(); $this->assertEquals($expected->getCode(), $actual->getCode(), 'Last standard module code must be same after deleting this one and calling module:refresh'); $this->assertEquals($expected->getType(), $actual->getType(), 'Last standard module type must be same after deleting this one and calling module:refresh'); $this->assertEquals($expected->getFullNamespace(), $actual->getFullNamespace(), 'Last standard module namespace must be same after deleting this one and calling module:refresh'); // Restore activation status $actual->setActivate($expected->getActivate())->save(); } else { $this->markTestIncomplete('This test cannot be complete without at least one standard module.'); } }
protected function execute(InputInterface $input, OutputInterface $output) { try { $moduleManagement = new ModuleManagement(); $moduleManagement->updateModules(); } catch (\Exception $e) { throw new \RuntimeException(sprintf('Refresh modules list fail with Exception : [%d] %s', $e->getCode(), $e->getMessage())); } if (method_exists($output, 'renderBlock')) { $output->renderBlock(['', 'Modules list successfully refreshed', ''], 'bg=green;fg=black'); } }
protected function execute(InputInterface $input, OutputInterface $output) { try { $moduleManagement = new ModuleManagement(); $moduleManagement->updateModules($this->getContainer()); } catch (InvalidModuleException $ime) { throw new \RuntimeException(sprintf('One or more modules could not be refreshed : %s', $ime->getErrorsAsString("\n"))); } catch (\Exception $e) { throw new \RuntimeException(sprintf('Refresh modules list fail with Exception : [%d] %s', $e->getCode(), $e->getMessage())); } if (method_exists($output, 'renderBlock')) { $output->renderBlock(['', 'Modules list successfully refreshed', ''], 'bg=green;fg=black'); } }
public function indexAction() { if (null !== ($response = $this->checkAuth(AdminResources::MODULE, array(), AccessManager::VIEW))) { return $response; } try { $moduleManagement = new ModuleManagement(); $moduleManagement->updateModules($this->getContainer()); } catch (InvalidModuleException $ex) { $this->moduleErrors = $ex->getErrors(); } catch (Exception $ex) { Tlog::getInstance()->addError("Failed to get modules list:", $ex); } return $this->renderList(); }
public function indexAction() { if (null !== ($response = $this->checkAuth(AdminResources::MODULE, array(), AccessManager::VIEW))) { return $response; } $moduleManagement = new ModuleManagement(); $moduleManagement->updateModules(); return $this->renderList(); }