当前位置: 首页>>代码示例>>PHP>>正文


PHP oxDb::setDbObject方法代码示例

本文整理汇总了PHP中oxDb::setDbObject方法的典型用法代码示例。如果您正苦于以下问题:PHP oxDb::setDbObject方法的具体用法?PHP oxDb::setDbObject怎么用?PHP oxDb::setDbObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在oxDb的用法示例。


在下文中一共展示了oxDb::setDbObject方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testEncodeStaticUrlsInsertingNewRecords

 public function testEncodeStaticUrlsInsertingNewRecords()
 {
     $aStaticUrl = array('oxseo__oxseourl' => array('de/de', 'eng/eng'), 'oxseo__oxstdurl' => 'xxx', 'oxseo__oxobjectid' => '-1');
     $oEncoder = $this->getMock('oxSeoEncoder', array('_getUniqueSeoUrl', '_trimUrl'));
     $oEncoder->expects($this->exactly(2))->method('_getUniqueSeoUrl')->will($this->returnValue('yyy'));
     $oEncoder->expects($this->atLeastOnce())->method('_trimUrl')->will($this->returnValue('yyy'));
     $dbMock = $this->getDbObjectMock();
     $dbMock->expects($this->any())->method('execute')->will($this->returnCallback(array($this, 'fillDbQueryBuffer')));
     oxDb::setDbObject($dbMock);
     $oEncoder->encodeStaticUrls($aStaticUrl, 1, 0);
     $this->assertEquals(1, count($this->dbQueryBuffer));
     $sQ = "insert into oxseo ( oxobjectid, oxident, oxshopid, oxlang, oxstdurl, oxseourl, oxtype ) values ";
     $sQ .= "( '" . md5('1yyy') . "', '" . md5('yyy') . "', '1', '0', 'yyy', 'yyy', 'static' ), ";
     $sQ .= "( '" . md5('1yyy') . "', '" . md5('yyy') . "', '1', '1', 'yyy', 'yyy', 'static' ) ";
     $this->assertEquals($sQ, $this->dbQueryBuffer[0]);
 }
开发者ID:Crease29,项目名称:oxideshop_ce,代码行数:16,代码来源:oxseoencoderTest.php

示例2: testInitArticleProductIsNotAwailable

 /**
  * DynExportBase::InitArticle() test case
  *
  * @return null
  */
 public function testInitArticleProductIsNotAwailable()
 {
     $dbMock = $this->getDbObjectMock();
     $dbMock->expects($this->any())->method('selectLimit')->will($this->returnCallback(function ($s, $i, $c) {
         throw new Exception($s . $i . $c);
     }));
     oxDb::setDbObject($dbMock);
     $oView = new _DynExportBase();
     $blClose = true;
     try {
         $oView->initArticle("testdynexportbasetable", 0, $blClose);
     } catch (Exception $oExcp) {
         $this->assertEquals("select oxid from testdynexportbasetable10", $oExcp->getMessage(), "Error in DynExportBase::InitArticle()");
         return;
     }
     $this->fail("Error in DynExportBase::InitArticle()");
 }
开发者ID:Crease29,项目名称:oxideshop_ce,代码行数:22,代码来源:dynexportbaseTest.php

示例3: testGetFilterSql

 /**
  * Test get filter sql.
  *
  * @return null
  */
 public function testGetFilterSql()
 {
     $sCatId = $this->getTestConfig()->getShopEdition() == 'EE' ? '30e44ab85808a1f05.26160932' : '8a142c3e60a535f16.78077188';
     $oTest = $this->getProxyClass('oxArticleList');
     $sRes = '';
     $dbMock = $this->getDbObjectMock();
     $dbMock->expects($this->any())->method('getAll')->will($this->returnCallback(function ($s) {
         throw new Exception($s);
     }));
     oxDb::setDbObject($dbMock);
     try {
         $oTest->UNITgetFilterSql($sCatId, array("8a142c3ee0edb75d4.80743302" => "Zeiger", "8a142c3e9cd961518.80299776" => "originell"));
     } catch (Exception $e) {
         $sRes = $e->getMessage();
     }
     $this->setLanguage(0);
     modDB::getInstance()->cleanup();
     $sO2CView = getViewName('oxobject2category');
     $sO2AView = getViewName('oxobject2attribute');
     $sExpt = "select oc.oxobjectid as oxobjectid, count(*)as cnt from\n            (SELECT * FROM {$sO2CView} WHERE {$sO2CView}.oxcatnid='{$sCatId}' GROUP BY {$sO2CView}.oxobjectid, {$sO2CView}.oxcatnid) as oc\n            INNER JOIN {$sO2AView} as oa ON(oa.oxobjectid=oc.oxobjectid)\n            WHERE (oa.oxattrid='8a142c3ee0edb75d4.80743302' and oa.oxvalue='Zeiger')\n                or (oa.oxattrid='8a142c3e9cd961518.80299776'andoa.oxvalue='originell')\n            GROUPBY oa.oxobjectid\n            HAVING cnt=2";
     $sExpt = str_replace(array("\n", "\r", " ", "\t"), "", $sExpt);
     $sRes = str_replace(array("\n", "\r", " ", "\t"), "", $sRes);
     $this->assertEquals($sExpt, $sRes);
 }
开发者ID:Crease29,项目名称:oxideshop_ce,代码行数:29,代码来源:oxarticlelistTest.php

示例4: 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);
 }
开发者ID:Crease29,项目名称:oxideshop_ce,代码行数:16,代码来源:oxactionsTest.php

示例5: testInsert

 /**
  * base test
  */
 public function testInsert()
 {
     $oObj = $this->getMock('oxi18n', array('_getLanguageSetTables'));
     $oObj->expects($this->any())->method('_getLanguageSetTables')->will($this->returnValue(array('oxstates_set11')));
     $oObj->init('oxstates');
     $oObj->setId("test_insert");
     $oObj->oxstates__oxtitle = new oxField('test_x');
     $dbMock = $this->getDbObjectMock();
     $dbMock->expects($this->any())->method('select')->will($this->returnValue(false));
     $dbMock->expects($this->any())->method('execute')->will($this->evalFunction('{Unit_Core_oxi18ntest::$aLoggedSqls[] = $args[0];return true;}'));
     oxDb::setDbObject($dbMock);
     $oObj->setLanguage(0);
     Unit_Core_oxi18ntest::$aLoggedSqls = array();
     $oObj->UNITinsert();
     $this->assertEquals(array("Insert into oxstates set oxid = 'test_insert',oxcountryid = '',oxtitle = 'test_x',oxisoalpha2 = ''", "insert into oxstates_set11 set oxid = 'test_insert'"), array_map('trim', Unit_Core_oxi18ntest::$aLoggedSqls));
     $oObj->setLanguage(90);
     Unit_Core_oxi18ntest::$aLoggedSqls = array();
     $oObj->UNITinsert();
     $this->assertEquals(array("Insert into oxstates set oxid = 'test_insert',oxcountryid = '',oxisoalpha2 = ''", "insert into oxstates_set11 set oxid = 'test_insert',oxtitle_90 = 'test_x'"), array_map('trim', Unit_Core_oxi18ntest::$aLoggedSqls));
 }
开发者ID:Crease29,项目名称:oxideshop_ce,代码行数:23,代码来源:I18nTest.php

示例6: testAreAnyActivePromotions

 /**
  * oxActionList::areAnyActivePromotions() test case
  * test if return value is in the true case "true" and the other way around.
  *
  * @dataProvider testAreAnyActivePromotionsDataProvider
  */
 public function testAreAnyActivePromotions($response, $expected)
 {
     $sShopId = $this->getConfig()->getShopId();
     $sView = getViewName('oxactions');
     $sSql = "select 1 from {$sView} where oxtype=2 and oxactive=1 and oxshopid='" . $sShopId . "' limit 1";
     $dbMock = $this->getDbObjectMock();
     $dbMock->expects($this->any())->method('getOne')->with($this->equalTo($sSql))->will($this->returnValue($response));
     oxDb::setDbObject($dbMock);
     $oAL = oxNew('oxActionList');
     $this->assertEquals($expected, $oAL->areAnyActivePromotions());
 }
开发者ID:Crease29,项目名称:oxideshop_ce,代码行数:17,代码来源:oxactionlistTest.php

示例7: testGetMissingTemplateBlocksIfFound

 /**
  * base functionality test
  */
 public function testGetMissingTemplateBlocksIfFound()
 {
     $oCfg = $this->getMock('oxconfig', array('getShopId'));
     $oCfg->expects($this->exactly(1))->method('getShopId')->will($this->returnValue(15));
     oxTestModules::addModuleObject('oxconfig', $oCfg);
     $oRs = $this->getMock('stdclass', array('moveNext', 'recordCount'));
     $oRs->expects($this->exactly(1))->method('moveNext')->will($this->evalFunction('{$_this->EOF = true;}'));
     $oRs->expects($this->exactly(1))->method('recordCount')->will($this->returnValue(1));
     $oRs->fields = array('OXTEMPLATE' => '_OXTEMPLATE_', 'OXBLOCKNAME' => '_OXBLOCKNAME_', 'OXMODULE' => '_OXMODULE_');
     $dbMock = $this->getDbObjectMock();
     $dbMock->expects($this->any())->method('execute')->with($this->equalTo("select * from oxtplblocks where oxactive=1 and oxshopid='15'"))->will($this->returnValue($oRs));
     oxDb::setDbObject($dbMock);
     $oSR = $this->getMock('oxSysRequirements', array('_checkTemplateBlock'));
     $oSR->expects($this->exactly(1))->method('_checkTemplateBlock')->with($this->equalTo("_OXTEMPLATE_"), $this->equalTo("_OXBLOCKNAME_"))->will($this->returnValue(true));
     $this->assertEquals(array(), $oSR->getMissingTemplateBlocks());
 }
开发者ID:Crease29,项目名称:oxideshop_ce,代码行数:19,代码来源:oxsysrequirementsTest.php

示例8: testInPriceCategoryException

 /**
  * Test in price category with exception case.
  *
  * @return null
  */
 public function testInPriceCategoryException()
 {
     $oA = oxNew('oxArticle');
     $oA->setId('_testx');
     $oA->oxarticles__oxprice = new oxField(95);
     $dbMock = $this->getDbObjectMock();
     $dbMock->expects($this->any())->method('getOne')->will($this->returnCallback(function ($s) {
         throw new Exception($s);
     }));
     oxDb::setDbObject($dbMock);
     try {
         $oA->inPriceCategory('sCatNid');
     } catch (Exception $e) {
         if ($this->getConfig()->getEdition() === 'EE') {
             $this->assertEquals("select 1 from oxv_oxcategories_1_de where oxid='sCatNid' and(   (oxpricefrom != 0 and oxpriceto != 0 and oxpricefrom <= '95' and oxpriceto >= '95') or (oxpricefrom != 0 and oxpriceto = 0 and oxpricefrom <= '95') or (oxpricefrom = 0 and oxpriceto != 0 and oxpriceto >= '95'))", $e->getMessage());
         } else {
             $this->assertEquals("select 1 from oxv_oxcategories_de where oxid='sCatNid' and(   (oxpricefrom != 0 and oxpriceto != 0 and oxpricefrom <= '95' and oxpriceto >= '95') or (oxpricefrom != 0 and oxpriceto = 0 and oxpricefrom <= '95') or (oxpricefrom = 0 and oxpriceto != 0 and oxpriceto >= '95'))", $e->getMessage());
         }
         return;
     }
     $this->fail('exception from oxdb not thrown');
 }
开发者ID:Crease29,项目名称:oxideshop_ce,代码行数:27,代码来源:oxarticleTest.php

示例9: testCheckAccessRightsChecksSubshopAdminShop

 public function testCheckAccessRightsChecksSubshopAdminShop()
 {
     $mySession = oxRegistry::getSession();
     $backUpAuth = $mySession->getVariable("auth");
     $dbMock = $this->getDbObjectMock();
     $dbMock->expects($this->any())->method('getOne')->will($this->returnValue(1));
     oxDb::setDbObject($dbMock);
     $e = null;
     try {
         $mySession->setVariable("auth", "blafooUser");
         $this->assertEquals(true, oxRegistry::getUtils()->checkAccessRights());
         $this->setRequestParameter('fnc', 'chshp');
         $this->assertEquals(false, oxRegistry::getUtils()->checkAccessRights());
         $this->setRequestParameter('fnc', null);
         $this->assertEquals(true, oxRegistry::getUtils()->checkAccessRights());
         $this->setRequestParameter('actshop', 1);
         $this->assertEquals(true, oxRegistry::getUtils()->checkAccessRights());
         $this->setRequestParameter('actshop', 2);
         $this->assertEquals(false, oxRegistry::getUtils()->checkAccessRights());
         $this->setRequestParameter('actshop', null);
         $this->assertEquals(true, oxRegistry::getUtils()->checkAccessRights());
         $this->setRequestParameter('shp', 1);
         $this->assertEquals(true, oxRegistry::getUtils()->checkAccessRights());
         $this->setRequestParameter('shp', 2);
         $this->assertEquals(false, oxRegistry::getUtils()->checkAccessRights());
         $this->setRequestParameter('shp', null);
         $this->assertEquals(true, oxRegistry::getUtils()->checkAccessRights());
         $this->setRequestParameter('currentadminshop', 1);
         $this->assertEquals(true, oxRegistry::getUtils()->checkAccessRights());
         $this->setRequestParameter('currentadminshop', 2);
         $this->assertEquals(false, oxRegistry::getUtils()->checkAccessRights());
         $this->setRequestParameter('currentadminshop', null);
         $this->assertEquals(true, oxRegistry::getUtils()->checkAccessRights());
     } catch (Exception $e) {
     }
     $mySession->setVariable("auth", $backUpAuth);
     if ($e) {
         throw $e;
     }
 }
开发者ID:Crease29,项目名称:oxideshop_ce,代码行数:40,代码来源:oxutilsTest.php

示例10: testIsPicDeletableNoPic

 /**
  * Test IsPicDeletable with nopic.jpg case.
  */
 public function testIsPicDeletableNoPic()
 {
     $myUtils = oxNew('oxUtilsPic');
     $dbMock = $this->getDbObjectMock();
     $dbMock->expects($this->never())->method('getOne');
     oxDb::setDbObject($dbMock);
     $this->assertEquals(false, $myUtils->UNITisPicDeletable('nopic.jpg', 'test', 'file'));
 }
开发者ID:Crease29,项目名称:oxideshop_ce,代码行数:11,代码来源:oxutilspicTest.php


注:本文中的oxDb::setDbObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。