/** * Tests check if changed module config values are the same after deactivation / activation * * @dataProvider providerModuleIsActive * * @param array $aInstallModules * @param string $sModuleId * @param array $aConfigsToChange * @param array $aResultToAsserts */ public function testModuleConfigs($aInstallModules, $sModuleId, $aConfigsToChange, $aResultToAsserts) { $oEnvironment = new Environment(); $oEnvironment->prepare($aInstallModules); $oModule = oxNew('oxModule'); $oModule->load($sModuleId); $this->changeConfiguration($sModuleId, $aConfigsToChange); $this->deactivateModule($oModule); $this->activateModule($oModule); $this->runAsserts($aResultToAsserts); }
/** * Test check shop module deactivation */ public function testModuleDeactivate() { $oConfig = oxRegistry::getConfig(); $sState = $oConfig->getConfigParam('sTestDeactivateEvent'); $this->assertSame(null, $sState, 'No events should have been executed till now'); $oEnvironment = new Environment(); $oEnvironment->prepare(array('with_events')); $oModule = oxNew('oxModule'); $oModule->load('with_events'); $this->deactivateModule($oModule); $sState = $oConfig->getConfigParam('sTestDeactivateEvent'); $this->assertEquals("Deactivate", $sState, 'onDeactivate event was not called.'); }
/** * Tests if module was activated. */ public function testVersionNotify() { $oEnvironment = new Environment(); $oEnvironment->prepare(array('extending_1_class', 'extending_1_class_3_extensions', 'with_everything')); /** @var oxOnlineModuleVersionNotifierCaller|MockObject $oCaller */ $oCaller = $this->getMock('oxOnlineModuleVersionNotifierCaller', array('doRequest'), array(), '', false); $oCaller->expects($this->any())->method('doRequest')->with($this->equalTo($this->getExpectedRequest())); $oModuleList = oxNew('oxModuleList'); $sModuleDir = __DIR__ . '/TestData/modules'; $oModuleList->getModulesFromDir($sModuleDir); $oNotifier = new oxOnlineModuleVersionNotifier($oCaller, $oModuleList); $oNotifier->versionNotify(); }
/** * Test check shop environment after module deactivation in subshop. * * @dataProvider providerModuleDeactivation * * @param array $aInstallModules * @param array $aRemovedExtensions * @param array $aResultToAssert */ public function testModuleRemoveInSubShop($aInstallModules, $aRemovedExtensions, $aResultToAssert) { if ($this->getTestConfig()->getShopEdition() != 'EE') { $this->markTestSkipped("This test case is only actual when SubShops are available."); } $oEnvironment = new Environment(); $oEnvironment->prepare($aInstallModules); $oEnvironment->setShopId(2); $oEnvironment->activateModules($aInstallModules); /** @var oxModuleList|MockObject $oModuleList */ $oModuleList = $this->getMock('oxModuleList', array('getDeletedExtensions')); $oModuleList->expects($this->any())->method('getDeletedExtensions')->will($this->returnValue($aRemovedExtensions)); $oModuleList->cleanup(); //Assert on subshop $this->runAsserts($aResultToAssert); $this->markTestIncomplete('Skipped till cleanup for subshops will be fixed'); //Assert on main shop $oEnvironment->setShopId(1); $this->runAsserts($aResultToAssert); }
/** * Tests check if changed extensions order stays the same after deactivation / activation * * @dataProvider providerModuleReorderExtensions * * @param array $aInstallModules * @param string $sModule * @param array $aReorderedExtensions * @param array $aNotReorderedExtensions */ public function testIfNotReorderedOnSubShop($aInstallModules, $sModule, $aReorderedExtensions, $aNotReorderedExtensions) { if ($this->getTestConfig()->getShopEdition() != 'EE') { $this->markTestSkipped("This test case is only actual when SubShops are available."); } $oConfig = oxRegistry::getConfig(); $oEnvironment = new Environment(); $oEnvironment->prepare($aInstallModules); $oValidator = new Validator($oConfig); $oModule = oxNew('oxModule'); $oEnvironment->setShopId(2); $oEnvironment->activateModules($aInstallModules); // load reordered extensions for shop $oEnvironment->setShopId(1); $oConfig->setConfigParam('aModules', $aReorderedExtensions); $oModule->load($sModule); $this->deactivateModule($oModule); $this->activateModule($oModule); $oEnvironment->setShopId(2); $this->assertTrue($oValidator->checkExtensions($aNotReorderedExtensions), 'Extension order changed'); }
/** * Tear down the fixture. */ protected function tearDown() { $oEnvironment = new Environment(); $oEnvironment->clean(); parent::tearDown(); }