本文整理汇总了PHP中oxRegistry::set方法的典型用法代码示例。如果您正苦于以下问题:PHP oxRegistry::set方法的具体用法?PHP oxRegistry::set怎么用?PHP oxRegistry::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oxRegistry
的用法示例。
在下文中一共展示了oxRegistry::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _prepareCurrentTime
/**
* @param int $iCurrentTime
*/
private function _prepareCurrentTime($iCurrentTime)
{
$oUtilsDate = $this->getMock('oxUtilsDate', array('getTime'));
$oUtilsDate->expects($this->any())->method('getTime')->will($this->returnValue($iCurrentTime));
/** @var oxUtilsDate $oUtils */
oxRegistry::set('oxUtilsDate', $oUtilsDate);
}
示例2: testColons
/**
* Test colon smarty modifier
*
* @dataProvider provider
*/
public function testColons($sTranslation, $sResult)
{
$oLang = $this->getMock("oxLang", array("translateString"));
$oLang->expects($this->any())->method("translateString")->with($this->equalTo('COLON'))->will($this->returnValue($sTranslation));
oxRegistry::set('oxLang', $oLang);
$this->assertEquals($sResult, smarty_modifier_colon('Name'));
}
示例3: __construct
/**
* Class constructor.
* Sets current module main data and loads the rest module info.
*/
function __construct()
{
$sModuleId = 'oxpsmodulegenerator';
$this->setModuleData(array('id' => $sModuleId, 'title' => 'OXID Module Skeleton Generator', 'description' => 'Folders structure, empty classes and metadata generation for new OXID eShop modules.'));
$this->load($sModuleId);
oxRegistry::set('oxpsModuleGeneratorModule', $this);
}
示例4: testAdminLoginWithOldPasswordMultishop
/**
* Tries to login with old password from different subshop, makes sure there are no crashes
*/
public function testAdminLoginWithOldPasswordMultishop()
{
$this->setAdminMode(true);
//faking cookie check
$oUtils = $this->getMock("oxUtilsServer", array("getOxCookie"));
$oUtils->expects($this->any())->method("getOxCookie")->will($this->returnValue(array("test" => "test")));
oxRegistry::set("oxUtilsServer", $oUtils);
//creating test admin user
$oUser = $this->_createUser($this->_sDefaultUserName, $this->_sOldEncodedPassword, $this->_sOldSalt);
//updating user over oxBase methods as oxUser restricts rights update
$oUpdUser = oxNew('oxBase');
$oUpdUser->init("oxuser");
$oUpdUser->load($oUser->getId());
$oUpdUser->oxuser__oxrights = new oxField(1);
$oUpdUser->oxuser__oxshopid = new oxField(1);
$oUpdUser->save();
//set active shop 2
oxRegistry::getConfig()->setShopId(2);
//perform the login
$this->_login($this->_sDefaultUserName, $this->_sDefaultUserPassword);
$oUser->load($oUser->getId());
$this->assertEquals(1, $oUser->oxuser__oxshopid->value, "User shop ID changed");
$this->assertSame($oUser->getId(), oxRegistry::getSession()->getVariable('auth'), 'User ID is missing in session.');
$this->assertNotSame($this->_sOldEncodedPassword, $oUser->oxuser__oxpassword->value, 'Old and new passwords must not match.');
$this->assertNotSame($this->_sOldSalt, $oUser->oxuser__oxpasssalt->value, 'Old and new salt must not match.');
}
示例5: __construct
/**
* Class constructor.
* Sets main module data and load additional data.
*/
function __construct($sModuleTitle = 'Paymorrow Payments', $sModuleDescription = 'Paymorrow Payments Module')
{
$sModuleId = 'oxpspaymorrow';
$this->setModuleData(array('id' => $sModuleId, 'title' => $sModuleTitle, 'description' => $sModuleDescription));
$this->load($sModuleId);
// Add the module class to oxRegistry
oxRegistry::set('OxpsPaymorrowModule', $this);
}
示例6: _resetRegistry
/**
* Cleans up the registry before/after the test execution
*
* @return null;
*/
protected function _resetRegistry()
{
$aRegKeys = oxRegistry::getKeys();
$aSkippedClasses = array("oxconfigfile");
foreach ($aRegKeys as $sKey) {
if (!in_array($sKey, $aSkippedClasses)) {
oxRegistry::set($sKey, null);
}
}
}
示例7: testRender
/**
* Test view render.
*
* @return null
*/
public function testRender()
{
$_SERVER['HTTP_COOKIE'] = "shop=1";
$oView = oxNew('ClearCookies');
$oUtilsServer = $this->getMock('oxUtilsServer', array('setOxCookie'));
$oUtilsServer->expects($this->at(0))->method('setOxCookie')->with($this->equalTo('shop'));
$oUtilsServer->expects($this->at(1))->method('setOxCookie')->with($this->equalTo('language'));
$oUtilsServer->expects($this->at(2))->method('setOxCookie')->with($this->equalTo('displayedCookiesNotification'));
oxRegistry::set('oxUtilsServer', $oUtilsServer);
$this->assertEquals('page/info/clearcookies.tpl', $oView->render());
}
示例8: setUp
/**
* Set SUT state before test.
*/
public function setUp()
{
parent::setUp();
$this->SUT = $this->getMock('oxpsModulesConfigRequestValidator', array('__call', '_isReadableFile'));
$this->SUT->expects($this->any())->method('_isReadableFile')->will($this->returnValue(true));
// Content model mock
$oContent = $this->getMock('oxpsModulesConfigContent', array('__call', 'getModulesList', 'getSettingsList'));
$oContent->expects($this->any())->method('getModulesList')->will($this->returnValue(array('my_module' => (object) array('version' => '1.0.0'), 'good_extension' => (object) array('version' => '0.2.5'))));
$oContent->expects($this->any())->method('getSettingsList')->will($this->returnValue(array('version' => 'Versions', 'extend' => 'Extended classes')));
oxRegistry::set('oxpsModulesConfigContent', $oContent);
}
示例9: testGetModulesList
public function testGetModulesList()
{
// Config mock
$oConfig = $this->getMock('oxConfig', array('getModulesDir'));
$oConfig->expects($this->once())->method('getModulesDir')->will($this->returnValue('/shop/modules/'));
oxRegistry::set('oxConfig', $oConfig);
// Modules list mock
$oModuleList = $this->getMock('oxModuleList', array('__call', 'getModulesFromDir'));
$oModuleList->expects($this->once())->method('getModulesFromDir')->with('/shop/modules/')->will($this->returnValue(array('my_module' => (object) array('version' => '1.0.0'), 'oxpsmodulesconfig' => (object) array('version' => '0.1.0'), 'good_extension' => (object) array('version' => '0.2.5'))));
oxTestModules::addModuleObject('oxModuleList', $oModuleList);
$this->assertEquals(array('my_module' => (object) array('version' => '1.0.0'), 'good_extension' => (object) array('version' => '0.2.5')), $this->SUT->getModulesList());
}
示例10: testIncludeWidget
public function testIncludeWidget()
{
$oReverseProxyBackend = $this->getMock("oxReverseProxyBackend", array("isActive"), array(), '', false);
$oReverseProxyBackend->expects($this->any())->method("isActive")->will($this->returnValue(false));
oxRegistry::set("oxReverseProxyBackend", $oReverseProxyBackend);
$oShopControl = $this->getMock("oxWidgetControl", array("start"), array(), '', false);
$oShopControl->expects($this->any())->method("start")->will($this->returnValue('html'));
oxTestModules::addModuleObject('oxWidgetControl', $oShopControl);
$oSmarty = new Smarty();
$result = smarty_function_oxid_include_widget(array('cl' => 'oxwTagCloud', 'blShowTags' => 1), $oSmarty);
$this->assertEquals('html', $result);
}
示例11: prepare
/**
* Test helper for test preparation.
* Add given count of new languages.
*
* @param $count
*
* @return int
*/
protected function prepare($count = 9)
{
for ($i = 0; $i < $count; $i++) {
$languageName = chr(97 + $i) . chr(97 + $i);
$languageId = $this->insertLanguage($languageName);
}
//we need a fresh instance of language object in registry,
//otherwise stale data is used for language abbreviations.
oxRegistry::set('oxLang', null);
oxRegistry::set('oxTableViewNameGenerator', null);
$this->updateViews();
return $languageId;
}
示例12: testProcess_ProcessingOfServiceResponse_CommentAdded
/**
* Testing addition of comment after PayPal request processing
*/
public function testProcess_ProcessingOfServiceResponse_CommentAdded()
{
$oUtilsDate = $this->getMock('oxUtilsDate', array('getTime'));
$oUtilsDate->expects($this->any())->method('getTime')->will($this->returnValue(1410431540));
oxRegistry::set('oxUtilsDate', $oUtilsDate);
$sComment = 'testComment';
$oComment = new oePayPalOrderPaymentComment();
$oComment->setComment($sComment);
$oPayPalResponse = $this->_getPayPalResponse();
$oPayment = $this->_getPayment();
$oPayment->expects($this->once())->method('addComment')->with($this->equalTo($oComment));
$oPaymentList = $this->_getPaymentList(array('addPayment'));
$oPaymentList->expects($this->any())->method('addPayment')->will($this->returnValue($oPayment));
$oOrder = $this->_getOrder(array('getPaymentList'));
$oOrder->expects($this->any())->method('getPaymentList')->will($this->returnValue($oPaymentList));
$oData = $this->_getData();
$oData->expects($this->any())->method('getComment')->will($this->returnValue($sComment));
$oAction = $this->_getAction($oPayPalResponse, $oOrder, $oData);
$oAction->process();
}
示例13: testToWishList
/**
* Testing oxcmp_utils::toWishList()
*
* @return null
*/
public function testToWishList()
{
/** @var oxSession|PHPUnit_Framework_MockObject_MockObject $oSession */
$oSession = $this->getMock('oxSession', array('checkSessionChallenge'));
$oSession->expects($this->exactly(2))->method('checkSessionChallenge')->will($this->returnValue(true));
oxRegistry::set('oxSession', $oSession);
$this->getConfig()->setConfigParam("bl_showWishlist", false);
/** @var oxcmp_utils|PHPUnit_Framework_MockObject_MockObject $oCmp */
$oCmp = $this->getMock("oxcmp_utils", array("_toList"));
$oCmp->expects($this->never())->method('_toList');
$oCmp->toWishList('1126', 999, 'sel');
$this->getConfig()->setConfigParam("bl_showWishlist", true);
/** @var oxcmp_utils|PHPUnit_Framework_MockObject_MockObject $oCmp */
$oCmp = $this->getMock("oxcmp_utils", array("_toList"));
$oCmp->expects($this->once())->method('_toList')->with($this->equalTo('wishlist'), $this->equalTo('1126'), $this->equalTo(999), $this->equalTo('sel'));
$oCmp->toWishList('1126', 999, 'sel');
}
示例14: setToRegistryOxUtilsUrlMock
/**
* @param string $entryPoint
*/
private function setToRegistryOxUtilsUrlMock($entryPoint)
{
$utilsUrl = $this->getMock('oxUtilsUrl');
$utilsUrl->expects($this->atLeastOnce())->method('processUrl')->with($this->identicalTo($this->shopUrl . $entryPoint, false))->will($this->returnValue($this->shopUrl . $entryPoint . '?'));
oxRegistry::set('oxUtilsUrl', $utilsUrl);
}
示例15: testActionSubmit_importSuccess
public function testActionSubmit_importSuccess()
{
// Config mock
$oConfig = $this->getMock('oxConfig', array('getUploadedFile'));
$oConfig->expects($this->once())->method('getUploadedFile')->with('oxpsmodulesconfig_file')->will($this->returnValue(array('error' => '', 'type' => 'application/octet-stream', 'tmp_name' => '/path/to/good_file.json')));
oxRegistry::set('oxConfig', $oConfig);
modConfig::setRequestParameter('oxpsmodulesconfig_modules', array('my_module'));
modConfig::setRequestParameter('oxpsmodulesconfig_settings', array('version' => 1, 'extend' => 1));
modConfig::setRequestParameter('oxpsmodulesconfig_import', 1);
// Request validator instance mock
$oValidator = $this->getMock('oxpsModulesConfigRequestValidator', array('__call', 'validateRequestData', 'validateImportData', 'addErrors'));
$oValidator->expects($this->once())->method('validateRequestData')->with(array('modules' => array('my_module'), 'settings' => array('version', 'extend'), 'action' => 'import'))->will($this->returnValue(true));
$oValidator->expects($this->once())->method('validateImportData')->with(array('error' => '', 'type' => 'application/octet-stream', 'tmp_name' => '/path/to/good_file.json'))->will($this->returnValue(true));
$oValidator->expects($this->never())->method('addErrors');
oxRegistry::set('oxpsModulesConfigRequestValidator', $oValidator);
// Configuration data transfer handler mock
$oConfigTransfer = $this->getMock('oxpsModulesConfigTransfer', array('__call', 'backupToFile', 'setImportDataFromFile', 'importData', 'getImportErrors'));
$oConfigTransfer->expects($this->once())->method('backupToFile')->with(array('modules' => array('my_module', 'good_extension'), 'settings' => array('version', 'extend', 'files'), 'action' => ''), 'full_backup')->will($this->returnValue(true));
$oConfigTransfer->expects($this->once())->method('setImportDataFromFile')->with(array('error' => '', 'type' => 'application/octet-stream', 'tmp_name' => '/path/to/good_file.json'));
$oConfigTransfer->expects($this->once())->method('importData')->with(array('modules' => array('my_module'), 'settings' => array('version', 'extend'), 'action' => 'import'))->will($this->returnValue(true));
$oConfigTransfer->expects($this->never())->method('getImportErrors');
oxTestModules::addModuleObject('oxpsModulesConfigTransfer', $oConfigTransfer);
// Content model mock
$oContent = $this->getMock('oxpsModulesConfigContent', array('__call', 'getModulesList', 'getSettingsList'));
$oContent->expects($this->once())->method('getModulesList')->will($this->returnValue(array('my_module' => (object) array('version' => '1.0.0'), 'good_extension' => (object) array('version' => '0.2.5'))));
$oContent->expects($this->once())->method('getSettingsList')->will($this->returnValue(array('version' => 'Versions', 'extend' => 'Extended classes', 'files' => 'New classes')));
oxRegistry::set('oxpsModulesConfigContent', $oContent);
// Module instance mock
$oModule = $this->getMock('oxpsModulesConfigModule', array('__construct', '__call', 'clearTmp'));
//$oModule->expects($this->once())->method('clearTmp');
oxTestModules::addModuleObject('oxpsModulesConfigModule', $oModule);
$this->SUT->actionSubmit();
$this->assertSame('import', $this->SUT->getAction());
$this->assertSame(array('OXPS_MODULESCONFIG_MSG_BACKUP_SUCCESS', 'OXPS_MODULESCONFIG_MSG_IMPORT_SUCCESS'), $this->SUT->getMessages());
}