Exemplo n.º 1
0
 public function testGetDbVersionErrors()
 {
     $this->moduleResource->expects($this->any())->method('getDataVersion')->will($this->returnValue(2));
     $this->moduleResource->expects($this->any())->method('getDbVersion')->will($this->returnValue(2));
     $this->resourceResolver->expects($this->any())->method('getResourceList')->will($this->returnValueMap([['Module_One', ['resource_one']], ['Module_Two', ['resource_two']]]));
     $expectedErrors = [[DbVersionInfo::KEY_MODULE => 'Module_One', DbVersionInfo::KEY_CURRENT => '2', DbVersionInfo::KEY_REQUIRED => '1', DbVersionInfo::KEY_TYPE => 'schema'], [DbVersionInfo::KEY_MODULE => 'Module_One', DbVersionInfo::KEY_CURRENT => '2', DbVersionInfo::KEY_REQUIRED => '1', DbVersionInfo::KEY_TYPE => 'data']];
     $this->assertEquals($expectedErrors, $this->dbVersionInfo->getDbVersionErrors());
 }
Exemplo n.º 2
0
 /**
  * Apply database data updates whenever needed
  *
  * @return void
  */
 public function updateData()
 {
     foreach (array_keys($this->_moduleList->getModules()) as $moduleName) {
         foreach ($this->_resourceResolver->getResourceList($moduleName) as $resourceName) {
             if (!$this->_moduleManager->isDbDataUpToDate($moduleName, $resourceName)) {
                 $this->_setupFactory->create($resourceName, $moduleName)->applyDataUpdates();
             }
         }
     }
 }
Exemplo n.º 3
0
 /**
  * Apply database data updates whenever needed
  *
  * @return void
  */
 public function updateData()
 {
     if (!$this->_isUpdatedSchema) {
         return;
     }
     foreach (array_keys($this->_moduleList->getModules()) as $moduleName) {
         foreach ($this->_resourceResolver->getResourceList($moduleName) as $resourceName) {
             $this->_setupFactory->create($resourceName, $moduleName)->applyDataUpdates();
         }
     }
 }
Exemplo n.º 4
0
 /**
  * Check if DB is up to date
  *
  * @return bool
  */
 private function isDbUpToDate()
 {
     foreach (array_keys($this->moduleList->getModules()) as $moduleName) {
         foreach ($this->resourceResolver->getResourceList($moduleName) as $resourceName) {
             $isSchemaUpToDate = $this->moduleManager->isDbSchemaUpToDate($moduleName, $resourceName);
             $isDataUpToDate = $this->moduleManager->isDbDataUpToDate($moduleName, $resourceName);
             if (!$isSchemaUpToDate || !$isDataUpToDate) {
                 return false;
             }
         }
     }
     return true;
 }