本文整理汇总了PHP中oxTestModules::addModuleObject方法的典型用法代码示例。如果您正苦于以下问题:PHP oxTestModules::addModuleObject方法的具体用法?PHP oxTestModules::addModuleObject怎么用?PHP oxTestModules::addModuleObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oxTestModules
的用法示例。
在下文中一共展示了oxTestModules::addModuleObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testExecute
/**
* Test case for oxMaintenance::execute()
*
* @return null
*/
public function testExecute()
{
$oList = $this->getMock('oxArticleList', array('updateUpcomingPrices'));
$oList->expects($this->once())->method('updateUpcomingPrices')->with($this->equalTo(true));
oxTestModules::addModuleObject('oxarticlelist', $oList);
$oMaintenance = oxNew("oxMaintenance");
$oMaintenance->execute();
}
示例2: testGetCompareItemsInJson
/**
* Testing oxwServiceMenu::getCompareItems()
*
* @return null
*/
public function testGetCompareItemsInJson()
{
$aItems = array("testId1" => "testVal1", "testId2" => "testVal2", "testId3" => "testVal3");
$aResult = '{"testId1":"testVal1","testId2":"testVal2","testId3":"testVal3"}';
$oCompare = $this->getMock("compare", array("getCompareItems"));
$oCompare->expects($this->once())->method("getCompareItems")->will($this->returnValue($aItems));
oxTestModules::addModuleObject('compare', $oCompare);
$oServiceMenu = oxNew('oxwServiceMenu');
$this->assertEquals($aResult, $oServiceMenu->getCompareItems(true));
}
示例3: testGetSimilarRecommLists
/**
* Testing oxwRecomm::getSimilarRecommLists()
*
* @return null
*/
public function testGetSimilarRecommLists()
{
$oRecommList = $this->getMock("oxrecommlist", array("getRecommListsByIds"));
$oRecommList->expects($this->once())->method("getRecommListsByIds")->with($this->equalTo(array("articleId")))->will($this->returnValue("oxRecommListMock"));
oxTestModules::addModuleObject('oxrecommlist', $oRecommList);
$aParams["aArticleIds"] = array("articleId");
$oRecomm = oxNew('oxwRecommendation');
$oRecomm->setViewParameters($aParams);
$this->assertEquals("oxRecommListMock", $oRecomm->getSimilarRecommLists(), "Should try to create RecommList object.");
}
示例4: testPageClose
public function testPageClose()
{
$oSession = $this->getMock('oxSession', array('freeze'));
$oSession->expects($this->once())->method('freeze')->will($this->returnValue(null));
$oStart = $this->getMock('oxStart', array('getSession'));
$oStart->expects($this->once())->method('getSession')->will($this->returnValue($oSession));
$oUtils = $this->getMock('oxUtils', array('commitFileCache'));
$oUtils->expects($this->once())->method('commitFileCache')->will($this->returnValue(null));
oxTestModules::addModuleObject('oxUtils', $oUtils);
$this->assertEquals(null, $oStart->pageClose());
}
示例5: 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);
}
示例6: 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());
}
示例7: testDisableModule
public function testDisableModule()
{
$sModuleId = 'testId';
$oModule = oxNew('oxModule');
$oModule->load($sModuleId);
/** @var oxModuleVariablesLocator|MockObject $oUtilsObject */
$moduleVariablesLocator = $this->getMock('oxModuleVariablesLocator', array(), array(), '', false);
$moduleChainsGenerator = oxNew('oxModuleChainsGenerator', $moduleVariablesLocator);
$oModuleInstaller = $this->getMock('oxModuleInstaller', array('deactivate'));
$oModuleInstaller->expects($this->once())->method('deactivate')->with($oModule);
oxTestModules::addModuleObject('oxModuleInstaller', $oModuleInstaller);
$moduleChainsGenerator->disableModule($sModuleId);
}
示例8: testSendeMail
/**
* PriceAlarm_Send::SendeMail() test case
*
* @return null
*/
public function testSendeMail()
{
$oAlarm = $this->getMock('oxpricealarm', array('save', 'load'));
$oAlarm->expects($this->once())->method('load')->with($this->equalTo("paid"))->will($this->returnValue(true));
$oAlarm->expects($this->once())->method('save')->will($this->returnValue(true));
oxTestModules::addModuleObject('oxpricealarm', $oAlarm);
$oEmail = $this->getMock('oxemail', array('sendPricealarmToCustomer'));
$oEmail->expects($this->once())->method('sendPricealarmToCustomer')->with($this->equalTo("info@example.com"), $this->isInstanceOf('oxpricealarm'))->will($this->returnValue(true));
oxTestModules::addModuleObject('oxemail', $oEmail);
// testing..
$oView = oxNew('PriceAlarm_Send');
$oView->sendeMail("info@example.com", "", "paid", "");
}
示例9: testDownload
/**
* Test for oxFiles::StartDownload()
*/
public function testDownload()
{
$sFilePath = $this->createFile('out/downloads/test.jpg', 'test jpg file');
/** @var oxFile|PHPUnit_Framework_MockObject_MockObject $oFile */
$oFile = $this->getMock('oxFile', array('getStoreLocation', 'isUnderDownloadFolder'));
$oFile->expects($this->any())->method('getStoreLocation')->will($this->returnValue($sFilePath));
$oFile->expects($this->any())->method('isUnderDownloadFolder')->will($this->returnValue(true));
/** @var oxUtils|PHPUnit_Framework_MockObject_MockObject $oUtils */
$oUtils = $this->getMock('oxUtils', array('setHeader', 'showMessageAndExit'));
$oUtils->expects($this->any())->method('setHeader');
$oUtils->expects($this->once())->method('showMessageAndExit');
oxTestModules::addModuleObject('oxUtils', $oUtils);
ob_start();
$oFile->download();
$content = ob_get_contents();
ob_end_clean();
$this->assertEquals('test jpg file', $content);
}
示例10: setUp
/**
* Set SUT state before test.
* Create test folder for modules generation.
*/
public function setUp()
{
parent::setUp();
$this->SUT = $this->getMock('Admin_oxpsModuleGenerator', array('_Admin_oxpsModuleGenerator_init_parent', '_Admin_oxpsModuleGenerator_render_parent'));
// Mock config for module settings
$oConfig = oxRegistry::getConfig();
$oConfig->setConfigParam('oxpsModuleGeneratorVendorPrefix', 'test');
$oConfig->setConfigParam('oxpsModuleGeneratorModuleAuthor', 'TEST');
$oConfig->setConfigParam('oxpsModuleGeneratorAuthorLink', 'www.example.com');
$oConfig->setConfigParam('oxpsModuleGeneratorAuthorMail', 'test@example.com');
$oConfig->setConfigParam('oxpsModuleGeneratorCopyright', 'TEST ');
$oConfig->setConfigParam('oxpsModuleGeneratorComment', '* This is automatically generated test output.');
oxRegistry::set('oxConfig', $oConfig);
// Module instance mock for generation path only
$oModule = $this->getMock('oxpsModuleGeneratorOxModule', array('getVendorPath'));
$oModule->expects($this->any())->method('getVendorPath')->will($this->returnValue($this->_getTestPath('modules/test/')));
oxTestModules::addModuleObject('oxpsModuleGeneratorOxModule', $oModule);
@mkdir($this->_getTestPath());
@mkdir($this->_getTestPath('modules'));
}
示例11: testGetArticleList
/**
* Test get article list.
*
* @return null
*/
public function testGetArticleList()
{
$oUser = $this->getMock('oxUser', array('getId'));
$oUser->expects($this->any())->method('getId')->will($this->returnValue("userId"));
$oFileOrder = oxNew("oxorderfile");
$oFileOrder->oxorderfiles__oxorderarticleid = new oxField("testArtNr");
$oFileOrder->oxorderfiles__oxordernr = new oxField("testOrder");
$oFileOrder->oxorderfiles__oxorderdate = new oxField("2011-11-11 11:11:11");
$oFileOrder->oxorderfiles__oxarticletitle = new oxField("testArtTitle");
$oOrderFileList = $this->getMock('oxOrderFileList', array('loadUserFiles'));
$oOrderFileList->expects($this->any())->method('loadUserFiles')->will($this->returnValue("orderfilelist"));
$oOrderFileList[] = $oFileOrder;
oxTestModules::addModuleObject('oxOrderFileList', $oOrderFileList);
$oAccDownloads = $this->getMock('Account_Downloads', array('getUser'));
$oAccDownloads->expects($this->any())->method('getUser')->will($this->returnValue($oUser));
$aOrderFilesList = $oAccDownloads->getOrderFilesList();
$this->assertEquals("testOrder", $aOrderFilesList["testArtNr"]["oxordernr"]);
$this->assertEquals("2011-11-11 11:11", $aOrderFilesList["testArtNr"]["oxorderdate"]);
$this->assertEquals("testArtTitle", $aOrderFilesList["testArtNr"]["oxarticletitle"]);
$this->assertTrue($aOrderFilesList["testArtNr"]["oxorderfiles"][0] instanceof oxorderfile);
}
示例12: testAddPriceShopMall
/**
* Article_stock::addprice test case when updating existing stock prices in subshop
*
* @return null
*/
public function testAddPriceShopMall()
{
//set default params for first save
$this->setRequestParameter("editval", array("oxprice2article__oxamountto" => 123, "pricetype" => "oxaddabs", "price" => 9));
//set oxid
$sOXID = "_testId";
//expected shop id
$sShopId = $this->getTestConfig()->getShopEdition() == 'EE' ? '2' : 'oxbaseshop';
$oConfig = $this->getMock("oxConfig", array("getShopId"));
$oConfig->expects($this->any())->method('getShopId')->will($this->returnValue($sShopId));
$oBase = $this->getMock('oxbase', array('isDerived'));
$oBase->expects($this->any())->method('isDerived')->will($this->returnValue(false));
oxTestModules::addModuleObject('oxbase', $oBase);
$oView = $this->getMock("Article_Stock", array('getConfig', 'resetContentCache', 'getEditObjectId', 'oxNew'), array(), '', false);
$oView->expects($this->atLeastOnce())->method('getConfig')->will($this->returnValue($oConfig));
$oView->expects($this->atLeastOnce())->method('resetContentCache');
$oView->expects($this->atLeastOnce())->method('getEditObjectId')->will($this->returnValue('_testArtId'));
//init db
$oDb = oxDb::getDb();
//first add new stock price
$oView->addprice($sOXID);
$this->assertEquals("123", $oDb->getOne("select oxamountto from oxprice2article where oxid='_testId'"));
//pass update params
$aParams = array("oxprice2article__oxamountto" => 777, "pricetype" => "oxaddabs", "price" => 20);
$oView->addprice($sOXID, $aParams);
$this->assertEquals("777", $oDb->getOne("select oxamountto from oxprice2article where oxid='_testId'"));
$this->assertEquals($sShopId, $oDb->getOne("select oxshopid from oxprice2article where oxid='_testId'"));
//update only amount to
$aParams = array("oxprice2article__oxamountto" => 10101);
$oView->addprice($sOXID, $aParams);
$this->assertEquals("10101", $oDb->getOne("select oxamountto from oxprice2article where oxid='_testId'"));
$this->assertEquals($sShopId, $oDb->getOne("select oxshopid from oxprice2article where oxid='_testId'"));
}
示例13: testGetBannerArticle_Existing
/**
* test
*/
public function testGetBannerArticle_Existing()
{
$dbMock = $this->getBannerArticleMockWithSpecificReturn('2000');
oxDb::setDbObject($dbMock);
$oArticle = $this->getMock('stdclass', array('load'));
$oArticle->expects($this->once())->method('load')->with($this->equalTo('2000'))->will($this->returnValue(true));
oxTestModules::addModuleObject('oxarticle', $oArticle);
$oPromo = oxNew('oxActions');
$oPromo->setId('promoid');
$oArt = $oPromo->getBannerArticle();
$this->assertNotNull($oArt);
$this->assertSame($oArticle, $oArt);
}
示例14: testRender_invitationNotActive
/**
* Testing method render()
*
* @return null
*/
public function testRender_invitationNotActive()
{
$oConfig = $this->getConfig();
$oConfig->setConfigParam("blInvitationsEnabled", false);
$oUtils = $this->getMock('oxUtils', array('redirect'));
$oUtils->expects($this->once())->method('redirect')->with($this->equalTo($oConfig->getShopHomeURL()));
oxTestModules::addModuleObject('oxUtils', $oUtils);
$oView = $this->getProxyClass("invite");
$this->assertEquals(null, $oView->render());
}
示例15: testInitializeUserForCallBackPayPalUser
/**
* Test case for oePayPalOxUser::initializeUserForCallBackPayPalUser()
* Creating user
*
* @return null
*/
public function testInitializeUserForCallBackPayPalUser()
{
oxTestModules::addModuleObject('oxAddress', new oePayPalOxAddress());
$aPayPalData["SHIPTOSTREET"] = "testStreetName str. 12a";
$aPayPalData["SHIPTOCITY"] = "testCity";
$aPayPalData["SHIPTOSTATE"] = "SS";
$aPayPalData["SHIPTOCOUNTRY"] = "US";
$aPayPalData["SHIPTOZIP"] = "testZip";
$oPayPalUser = new oePayPalOxUser();
$oPayPalUser->initializeUserForCallBackPayPalUser($aPayPalData);
$this->assertTrue(is_string($oPayPalUser->getId()));
$this->assertEquals('testStreetName str.', $oPayPalUser->oxuser__oxstreet->value);
$this->assertEquals('12a', $oPayPalUser->oxuser__oxstreetnr->value);
$this->assertEquals('testCity', $oPayPalUser->oxuser__oxcity->value);
$this->assertEquals('testZip', $oPayPalUser->oxuser__oxzip->value);
$this->assertEquals('8f241f11096877ac0.98748826', $oPayPalUser->oxuser__oxcountryid->value);
$this->assertEquals('333', $oPayPalUser->oxuser__oxstateid->value);
}