function testIsInstallerStepCompleted() { $oStorage = OX_Admin_UI_Install_InstallUtils::getSessionStorage(); $oStatus = $oStorage->set('installStatus', null); $aTask = array('name' => 'test', 'type' => 'testtype'); $result = OX_Upgrade_Util_Job::isInstallerStepCompleted('database', $aTask); $this->assertFalse($result); $this->assertEqual($aTask['errors'], array('Installation process not detected')); unset($aTask['errors']); Mock::generatePartial('OX_Admin_UI_Install_InstallStatus', 'OX_Admin_UI_Install_InstallStatusMock', array('isInstall', 'isUpgrade')); $oInstallStatus = new OX_Admin_UI_Install_InstallStatusMock($this); $oInstallStatus->setReturnValue('isInstall', true); $oInstallStatus->setReturnValue('isUpgrade', false); $oStatus = $oStorage->set('installStatus', $oInstallStatus); $result = OX_Upgrade_Util_Job::isInstallerStepCompleted('database', $aTask); $this->assertFalse($result); $this->assertEqual($aTask['errors'], array('Invalid installation step detected')); unset($aTask['errors']); $oWizard = new OX_Admin_UI_Install_Wizard($oInstallStatus); $oWizard->markStepAsCompleted('database'); $result = OX_Upgrade_Util_Job::isInstallerStepCompleted('database', $aTask); $this->assertTrue($result); $this->assertTrue(empty($aTask['errors'])); $oWizard->reset(); $oStatus = $oStorage->set('installStatus', null); }
public function loginAction() { $oWizard = new OX_Admin_UI_Install_Wizard($this->getInstallStatus(), 'login'); $oForm = new OX_Admin_UI_Install_AdminLoginForm($this->oTranslation, $oWizard->getCurrentStep()); if ($oForm->validate()) { if (!OA_Upgrade_Login::checkLogin()) { $this->setModelProperty('aMessages', array('error' => array($GLOBALS['strUsernameOrPasswordWrong']))); } else { $oWizard->markStepAsCompleted(); $this->redirect($oWizard->getNextStep()); } } $this->setModelProperty('form', $oForm->serialize()); $this->setModelProperty('oWizard', $oWizard); $this->setModelProperty('loaderMessage', $GLOBALS['strLoginProgressMessage']); $this->setModelProperty('isUpgrade', $this->getInstallStatus()->isUpgrade()); }