本文整理汇总了PHP中Environment::prepare方法的典型用法代码示例。如果您正苦于以下问题:PHP Environment::prepare方法的具体用法?PHP Environment::prepare怎么用?PHP Environment::prepare使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Environment
的用法示例。
在下文中一共展示了Environment::prepare方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testModuleActivation
/**
* Tests if module was activated.
*
* @dataProvider providerModuleActivation
*
* @param array $aInstallModules
* @param string $sModule
* @param array $aResultToAsserts
*/
public function testModuleActivation($aInstallModules, $sModule, $aResultToAsserts)
{
$oEnvironment = new Environment();
$oEnvironment->prepare($aInstallModules);
$oModule = oxNew('oxModule');
$oModule->load($sModule);
$this->deactivateModule($oModule);
$this->activateModule($oModule);
$this->runAsserts($aResultToAsserts);
}
示例2: testModulesWithoutMetadataShouldBeAddToCleanupAllModulesWithMetadata
public function testModulesWithoutMetadataShouldBeAddToCleanupAllModulesWithMetadata()
{
// modules to be activated during test preparation
$aInstallModules = array('extending_1_class');
$oEnvironment = new Environment();
$oEnvironment->prepare($aInstallModules);
$oModuleList = oxNew('oxModuleList');
$aGarbage = $oModuleList->getDeletedExtensions();
$this->assertSame(array(), $aGarbage);
}
示例3: testModuleActivateWithSimilarName
/**
* Test check shop environment after activation of module with similar name as deactivated module
*
* @dataProvider providerModuleReactivation
*
* @param array $installModules
* @param string $sReactivateModule
* @param array $aResultToAssert
*/
public function testModuleActivateWithSimilarName($installModules, $sReactivateModule, $aResultToAssert)
{
$environment = new Environment();
$environment->prepare($installModules);
foreach ($installModules as $sModule) {
$oModule = oxNew('oxModule');
$this->deactivateModule($oModule, $sModule);
}
$oModule = oxNew('oxModule');
$this->activateModule($oModule, $sReactivateModule);
$this->runAsserts($aResultToAssert);
}
示例4: testModulesWithMissingFiles
public function testModulesWithMissingFiles()
{
$this->markTestSkipped('Currently we are not checking module files.');
// modules to be activated during test preparation
$aInstallModules = array('with_1_extension', 'with_2_files');
$oEnvironment = new Environment();
$oEnvironment->prepare($aInstallModules);
$oModuleList = oxNew('oxModuleList');
$aGarbage = $oModuleList->getDeletedExtensions();
$aExpect = array('with_1_extension' => array('extensions' => array('oxarticle' => 'with_1_extension/mybaseclass')), 'with_2_files' => array('files' => array('myexception' => 'with_2_files/core/exception/myexception.php', 'myconnection' => 'with_2_files/core/exception/myconnection.php')));
$this->assertSame($aExpect, $aGarbage);
}
示例5: testVersionNotify
/**
* 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|PHPUnit_Framework_MockObject_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 = realpath(dirname(__FILE__)) . '/testData/modules';
$oModuleList->getModulesFromDir($sModuleDir);
$oNotifier = new oxOnlineModuleVersionNotifier($oCaller, $oModuleList);
$oNotifier->versionNotify();
}
示例6: testModuleDeactivationInSubShop
/**
* Test check shop environment after module deactivation in subshop.
*
* @dataProvider providerModuleDeactivation
*
* @param array $aInstallModules
* @param string $sModuleId
* @param array $aResultToAssert
*/
public function testModuleDeactivationInSubShop($aInstallModules, $sModuleId, $aResultToAssert)
{
if ($this->getTestConfig()->getShopEdition() != 'EE') {
$this->markTestSkipped("This test case is only actual when SubShops are available.");
}
$oModule = oxNew('oxModule');
$oEnvironment = new Environment();
$oEnvironment->prepare($aInstallModules);
$oEnvironment->setShopId(2);
$oEnvironment->activateModules($aInstallModules);
$this->deactivateModule($oModule, $sModuleId);
$this->runAsserts($aResultToAssert);
}
示例7: testModuleDeactivate
/**
* 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.');
}
示例8: testModuleActivationWithNewMetaDataWithSubshops
/**
* Tests when existing active module's meta data is changed and module activates and deactivates
* development process
*
* @dataProvider providerModuleNewMetaData
*
* @param array $aInstallModules
* @param string $sModule
* @param array $aMetaData
* @param array $aResultToAsserts
* @param array $aResultToAssertForSubShop
*/
public function testModuleActivationWithNewMetaDataWithSubshops($aInstallModules, $sModule, $aMetaData, $aResultToAsserts, $aResultToAssertForSubShop)
{
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);
$oEnvironment->setShopId(1);
$oModule = oxNew('oxModule');
$oModule->load($sModule);
$this->deactivateModule($oModule);
$oModule->setModuleData($aMetaData);
$this->activateModule($oModule);
$oEnvironment->setShopId(2);
$this->runAsserts($aResultToAssertForSubShop);
}
示例9: testIsActive
/**
* Tests if module was activated.
*
* @dataProvider providerModuleIsActive
*
* @param array $aInstallModules
* @param array $aDeactivateModules
* @param array $aResultToAssert
*/
public function testIsActive($aInstallModules, $aDeactivateModules, $aResultToAssert)
{
$oEnvironment = new Environment();
$oEnvironment->prepare($aInstallModules);
//deactivation
$oModule = oxNew('oxModule');
foreach ($aDeactivateModules as $sModule) {
$this->deactivateModule($oModule, $sModule);
}
//assertion
foreach ($aResultToAssert['active'] as $sModule) {
$oModule->load($sModule);
$this->assertTrue($oModule->isActive());
}
foreach ($aResultToAssert['notActive'] as $sModule) {
$oModule->load($sModule);
$this->assertFalse($oModule->isActive());
}
}
示例10: testModuleRemoveInSubShop
/**
* 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|PHPUnit_Framework_MockObject_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);
}
示例11: prepare
/**
* @return void
*/
public static function prepare($output = false)
{
if ($output) {
$output->writeln('<info>Preparing storage...</info>');
}
Storage::prepare();
if ($output) {
$output->writeln('<info>Preparing environment...</info>');
}
Environment::prepare();
if ($output) {
$output->writeln('<info>Preparing composer...</info>');
}
Composer::download();
Composer::update();
if ($output) {
$output->writeln('<info>Updating database schema...</info>');
}
self::updateDatabaseSchema();
}
示例12: testIfNotReorderedOnSubShop
/**
* 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');
}
示例13: postInstallCmd
/**
*/
public static function postInstallCmd()
{
Storage::prepare();
Environment::prepare();
Console::updateDatabaseSchema();
}