Exemplo n.º 1
0
 public function testGetNames()
 {
     $this->setLoadAllExpectation(false);
     $this->setLoadConfigExpectation();
     $this->assertSame(['foo'], $this->model->getNames());
     $this->assertSame(['foo'], $this->model->getNames());
     // second time to ensure config loader is called once
 }
 public function testGetNames()
 {
     $this->config->expects($this->exactly(2))->method('resetData');
     $this->setLoadAllExpectation(false);
     $this->setLoadConfigExpectation();
     $this->assertSame(['foo'], $this->model->getNames());
     $this->assertSame(['foo'], $this->model->getNames());
     // second time to ensure config loader is called once
 }
Exemplo n.º 3
0
 public function testGetNames()
 {
     $this->config->expects($this->once())->method('isAvailable')->willReturn(true);
     $this->setLoadAllExpectation(false);
     $this->setLoadConfigExpectation();
     $this->assertSame(['foo'], $this->model->getNames());
     $this->assertSame(['foo'], $this->model->getNames());
     // second time to ensure config loader is called once
 }
 /**
  * Constructor
  *
  * @param ModuleList $list
  * @param ModuleList\Loader $loader
  * @param PackageInfoFactory $packageInfoFactory
  */
 public function __construct(ModuleList $list, ModuleList\Loader $loader, PackageInfoFactory $packageInfoFactory)
 {
     $this->enabledModuleList = $list->getNames();
     $this->fullModuleList = $loader->load();
     $packageInfo = $packageInfoFactory->create();
     $this->graph = $this->createGraph($packageInfo);
 }
Exemplo n.º 5
0
 /**
  * Load data from module translation files
  *
  * @return $this
  */
 protected function _loadModuleTranslation()
 {
     $currentModule = $this->getControllerModuleName();
     $allModulesExceptCurrent = array_diff($this->_moduleList->getNames(), [$currentModule]);
     $this->loadModuleTranslationByModulesList($allModulesExceptCurrent);
     $this->loadModuleTranslationByModulesList([$currentModule]);
     return $this;
 }
Exemplo n.º 6
0
 /**
  * Load data from module translation files
  *
  * @return $this
  */
 protected function _loadModuleTranslation()
 {
     foreach ($this->_moduleList->getNames() as $module) {
         $moduleFilePath = $this->_getModuleTranslationFile($module, $this->getLocale());
         $this->_addData($this->_getFileData($moduleFilePath));
     }
     return $this;
 }
 /**
  * Check if enabling module will conflict any modules
  *
  * @param string[] $moduleNames
  * @param string[] $currentlyEnabledModules
  *
  * @return array
  */
 public function checkConflictsWhenEnableModules($moduleNames, $currentlyEnabledModules = null)
 {
     $masterList = isset($currentlyEnabledModules) ? $currentlyEnabledModules : $this->list->getNames();
     // union of currently enabled modules and to-be-enabled modules
     $enabledModules = array_unique(array_merge($masterList, $moduleNames));
     $conflictsAll = [];
     foreach ($moduleNames as $moduleName) {
         $conflicts = [];
         foreach ($enabledModules as $enabledModule) {
             $messages = $this->getConflictMessages($enabledModule, $moduleName);
             if (!empty($messages)) {
                 $conflicts[] = implode("\n", $messages);
             }
         }
         $conflictsAll[$moduleName] = $conflicts;
     }
     return $conflictsAll;
 }