/** * Tear down the fixture. * * @return null */ protected function tearDown() { $this->getSession()->setVariable("gbSessionFormId", null); $this->getSession()->setVariable("Errors", null); oxDb::getDB()->execute('delete from oxgbentries'); parent::tearDown(); }
/** * Tear down the fixture. * * @return null */ protected function tearDown() { $myDB = oxDb::getDB(); // removing vouchers $sQ = 'delete from oxvouchers where oxvouchers.oxvoucherserieid = "' . $this->_sOxid . '"'; $myDB->Execute($sQ); parent::tearDown(); }
/** * Tear down the fixture. * * @return null */ protected function tearDown() { $myDB = oxDb::getDB(); $sQ = 'delete from oxuser where oxid="test"'; $myDB->Execute($sQ); $this->cleanUpTable('oxreviews'); oxRemClassModule('modOxUtilsDate'); parent::tearDown(); }
/** * Initialize the fixture. * * @return null */ protected function setUp() { oxUBaseHelper::resetComponentNames(); // adding article to recommendList $sQ = 'replace into oxrecommlists ( oxid, oxuserid, oxtitle, oxdesc, oxshopid ) values ( "testlist", "oxdefaultadmin", "oxtest", "oxtest", "' . $this->getConfig()->getShopId() . '" ) '; oxDb::getDB()->Execute($sQ); parent::setUp(); // backup $this->_sRequestMethod = $_SERVER["REQUEST_METHOD"]; $this->_sRequestUri = $_SERVER['REQUEST_URI']; }
/** * Tear down the fixture. * * @return null */ protected function tearDown() { $this->cleanUpTable('oxuser'); $myDB = oxDb::getDB(); $myDB->execute("delete from oxseo where oxobjectid = '_testArt'"); $myDB->execute("delete from oxnewssubscribed where oxuserid = '_testUser'"); oxArticleHelper::cleanup(); //resetting cached testing values $_GET["testReset"] = null; parent::tearDown(); }
/** * Tear down the fixture. * * @return null */ protected function tearDown() { $oArt = oxNew('oxArticle'); $oArt->delete('_testArtId'); $oArt = oxNew('oxArticle'); $oArt->delete('_testArtId2'); $myDB = oxDb::getDB(); $myDB->execute('delete from oxobject2selectlist'); $this->addTableForCleanup('oxobject2category'); parent::tearDown(); }
/** * Checking deletion and assign */ public function testDelete() { $myDB = oxDb::getDB(); $oSelList = oxNew('oxselectlist'); $oSelList->load('oxsellisttest'); $oSelList->delete(); $sQ = 'select count(*) from oxselectlist where oxid = "oxsellisttest" '; if ($myDB->getOne($sQ)) { $this->fail('records from oxselectlist are not deleted'); } $sQ = 'select count(*) from oxobject2selectlist where oxselnid = "oxsellisttest" '; if ($myDB->getOne($sQ)) { $this->fail('records from oxobject2selectlist are not deleted'); } }
/** * Tear down the fixture. */ protected function setUp() { // Dropping order payments table oxDb::getDB()->execute("DROP TABLE IF EXISTS `oepaypal_orderpayments`"); oxDb::getDB()->execute("DROP TABLE IF EXISTS `oepaypal_order`"); oxDb::getDB()->execute("DROP TABLE IF EXISTS `oepaypal_orderpaymentcomments`"); // Deleting PayPal payment method $oPayment = oxNew('oxPayment'); $oPayment->load('oxidpaypal'); $oPayment->delete(); // Deleting enabled PayPal RDFA $sSql = "DELETE FROM `oxobject2payment` WHERE `OXID` = 'oepaypalrdfa'"; oxDb::getDb()->execute($sSql); parent::setUp(); }
/** * order_remark::save() test case * * @return null */ public function testSave() { $this->setRequestParameter('oxid', '_testOrder'); $this->setRequestParameter('remarktext', 'test text'); $oOrder = oxNew('oxbase'); $oOrder->init('oxorder'); $oOrder->setId('_testOrder'); $oOrder->oxorder__oxuserid = new oxField('oxdefaultadmin'); $oOrder->save(); $oView = oxNew('order_remark'); $oView->save(); $oRemark = oxNew("oxRemark"); $oRemark->load("_testRemark"); $this->assertEquals('r', oxDb::getDB()->getOne('select oxtype from oxremark where oxtext = "test text"')); $this->assertEquals('oxdefaultadmin', oxDb::getDB()->getOne('select oxparentid from oxremark where oxtext = "test text"')); }
/** * Setting up users */ protected function setupUsers() { $myDB = oxDb::getDB(); $sTable = getViewName('oxuser'); $iLastCustNr = (int) $myDB->getOne('select max( oxcustnr ) from ' . $sTable) + 1; $this->_oUser = oxNew('oxuser'); $this->_oUser->oxuser__oxshopid = new oxField($this->getConfig()->getShopId(), oxField::T_RAW); $this->_oUser->oxuser__oxactive = new oxField(1, oxField::T_RAW); $this->_oUser->oxuser__oxrights = new oxField('user', oxField::T_RAW); $this->_oUser->oxuser__oxusername = new oxField('*****@*****.**', oxField::T_RAW); $this->_oUser->oxuser__oxpassword = new oxField(crc32('*****@*****.**'), oxField::T_RAW); $this->_oUser->oxuser__oxcustnr = new oxField($iLastCustNr + 1, oxField::T_RAW); $this->_oUser->oxuser__oxcountryid = new oxField("testCountry", oxField::T_RAW); $this->_oUser->save(); $sQ = 'insert into oxaddress ( oxid, oxuserid, oxaddressuserid, oxcountryid ) values ( "test_user", "' . $this->_oUser->getId() . '", "' . $this->_oUser->getId() . '", "testCountry" ) '; $myDB->Execute($sQ); }
public function testGetRecommList() { $myDB = oxDb::getDB(); $sShopId = $this->getConfig()->getShopId(); // adding article to recommendlist $sQ = 'insert into oxrecommlists ( oxid, oxuserid, oxtitle, oxdesc, oxshopid ) values ( "testlist", "oxdefaultadmin", "oxtest", "oxtest", "' . $sShopId . '" ) '; $myDB->Execute($sQ); $sQ = 'insert into oxobject2list ( oxid, oxobjectid, oxlistid, oxdesc ) values ( "testlist", "2000", "testlist", "test" ) '; $myDB->Execute($sQ); $oSuggest = $this->getProxyClass("suggest"); $oArticle = oxNew("oxArticle"); $oArticle->load('2000'); $oSuggest->setNonPublicVar("_oProduct", $oArticle); $aLists = $oSuggest->getRecommList(); $this->assertTrue($aLists instanceof oxList); $this->assertTrue($aLists instanceof oxList); $this->assertEquals(1, $aLists->count()); $this->assertEquals('testlist', $aLists['testlist']->getId()); $this->assertTrue(in_array($aLists['testlist']->getFirstArticle()->getId(), array('2000'))); }
public function testGetRecommLists() { $myDB = oxDb::getDB(); $sQ = 'insert into oxobject2list ( oxid, oxobjectid, oxlistid, oxdesc ) values ( "testlist2", "' . $this->sArticleID . '", "testlist2", "test" ) '; $myDB->Execute($sQ); $sQ = 'insert into oxobject2list ( oxid, oxobjectid, oxlistid, oxdesc ) values ( "testlist3", "2000", "testlist2", "test" ) '; $myDB->Execute($sQ); $oRecomm = oxNew('RecommList'); $this->setRequestParameter('searchrecomm', 'test'); $aLists = $oRecomm->getRecommLists('test'); $this->assertEquals(2, count($aLists)); }
/** * Tear down the fixture. */ protected function tearDown() { oxDb::getDB()->execute('delete from `oxorderfiles` '); parent::tearDown(); }
public function testGetArtCount() { $myDB = oxDb::getDB(); $sQ = 'insert into oxobject2list ( oxid, oxobjectid, oxlistid, oxdesc ) values ( "testlist3", "2000", "testlist", "test" ) '; $myDB->Execute($sQ); $oRecomm = oxNew('oxRecommList'); $oRecomm->load("testlist"); $this->assertEquals(2, $oRecomm->getArtCount('test')); }
/** * Test get attribute list. * * @return null */ public function testGetAttributeList() { $oCompare = $this->getProxyClass("compare"); $oArticle = oxNew("oxArticle"); $oCompare->setNonPublicVar("_oArtList", array('1672' => $oArticle, '6b661dda79318ca64ca06e97e4fbcb0a' => $oArticle)); $aAttributes = $oCompare->getAttributeList(); $sSelect = "select oxattrid, oxvalue from oxobject2attribute where oxobjectid = '1672'"; $rs = oxDb::getDB()->execute($sSelect); $sSelect = "select oxtitle from oxattribute where oxid = '" . $rs->fields[0] . "'"; $sTitle = oxDb::getDB()->getOne($sSelect); $this->assertEquals(9, count($aAttributes)); $this->assertEquals($rs->fields[1], $aAttributes[$rs->fields[0]]->aProd['1672']->value); $this->assertEquals($sTitle, $aAttributes[$rs->fields[0]]->title); }
/** * Converts a string to UTF format. * * @todo move to separate class instead of static * * @return array */ protected static function getDbChecksum() { $myDB = oxDb::getDB(); $myConfig = modConfig::getInstance(); $sSelect = 'select GROUP_CONCAT(DISTINCT t.TABLE_NAME) from INFORMATION_SCHEMA.tables as t where t.TABLE_SCHEMA = "' . $myConfig->getConfigParam('dbName') . '" and t.TABLE_NAME not like "oxv_%"'; $rs = $myDB->execute($sSelect); $sSelect = 'CHECKSUM TABLE ' . $rs->fields[0]; $rs = $myDB->execute($sSelect); if ($rs != false && $rs->RecordCount() > 0) { while (!$rs->EOF) { if (stripos($rs->fields[0], "oxv_") !== 0) { $aChecksum[$rs->fields[0]] = $rs->fields[1]; } $rs->MoveNext(); } } return $aChecksum; }
public function testSaveReviewIfOnlyRatingIsSet() { $this->setRequestParameter('rvw_txt', null); $this->setRequestParameter('artrating', '4'); $this->setRequestParameter('anid', 'test'); /** @var oxSession|PHPUnit_Framework_MockObject_MockObject $oSession */ $oSession = $this->getMock('oxSession', array('checkSessionChallenge')); $oSession->expects($this->once())->method('checkSessionChallenge')->will($this->returnValue(true)); oxRegistry::set('oxSession', $oSession); $oUser = oxNew('oxUser'); $oUser->load("oxdefaultadmin"); /** @var oxArticle|PHPUnit_Framework_MockObject_MockObject $oProduct */ $oProduct = $this->getMock('oxarticle', array('getId', 'addToRatingAverage')); $oProduct->expects($this->any())->method('getId')->will($this->returnValue('test')); $oProduct->expects($this->once())->method('addToRatingAverage'); /** @var Review|PHPUnit_Framework_MockObject_MockObject $oReview */ $oReview = $this->getMock('review', array('getReviewUser', '_getActiveObject', 'canAcceptFormData', "_getActiveType")); $oReview->expects($this->once())->method('getReviewUser')->will($this->returnValue($oUser)); $oReview->expects($this->once())->method('canAcceptFormData')->will($this->returnValue(true)); $oReview->expects($this->once())->method('_getActiveObject')->will($this->returnValue($oProduct)); $oReview->expects($this->once())->method('_getActiveType')->will($this->returnValue("oxarticle")); $oReview->saveReview(); $this->assertFalse(oxDb::getDB()->getOne('select oxobjectid from oxreviews where oxobjectid = "test"')); $this->assertEquals("test", oxDb::getDB()->getOne('select oxobjectid from oxratings where oxobjectid = "test"')); }
/** * Test get attributes. * * @return null */ public function testGetAttributes() { $sArtID = '1672'; $oArticle = oxNew('oxArticle'); $oArticle->load($sArtID); $oDetails = $this->getProxyClass('oxwArticleDetails'); $oDetails->setNonPublicVar("_oProduct", $oArticle); $sSelect = "select oxattrid from oxobject2attribute where oxobjectid = '{$sArtID}'"; $sID = oxDb::getDB()->getOne($sSelect); $sSelect = "select oxvalue from oxobject2attribute where oxattrid = '{$sID}' and oxobjectid = '{$sArtID}'"; $sExpectedValue = oxDb::getDB()->getOne($sSelect); $aAttrList = $oDetails->getAttributes(); $sAttribValue = $aAttrList[$sID]->value; $this->assertEquals($sExpectedValue, $sAttribValue); }
/** * voucherserie_groups_ajax::addGroupToVoucher() test case * * @return null */ public function testAddGroupToVoucher_allGroups() { $this->setRequestParameter("all", true); $this->setRequestParameter("synchoxid", "_testVoucherId1"); oxDb::getDB()->execute("delete from oxobject2group where oxid like '\\_test%'"); $this->assertEquals(0, oxDb::getDb()->getOne("select count(oxid) from oxobject2group where oxid like '_test%'")); $oView = $this->getMock("voucherserie_groups_ajax", array("_getQuery")); $oView->expects($this->once())->method('_getQuery')->will($this->returnValue("from oxv_oxgroups_de where oxid like '\\_test%'")); $oView->addGroupToVoucher(); $this->assertEquals(4, oxDb::getDb()->getOne("select count(oxid) from oxobject2group where oxobjectid = '_testVoucherId1'")); }
public function testBlockedUser() { $myDB = oxDb::getDB(); $sTable = getViewName('oxuser'); $iLastCustNr = (int) $myDB->getOne('select max( oxcustnr ) from ' . $sTable) + 1; $oUser = oxNew('oxuser'); $oUser->oxuser__oxshopid = new oxField($this->getConfig()->getShopId(), oxField::T_RAW); $oUser->oxuser__oxactive = new oxField(1, oxField::T_RAW); $oUser->oxuser__oxrights = new oxField('user', oxField::T_RAW); $oUser->oxuser__oxusername = new oxField('*****@*****.**', oxField::T_RAW); $oUser->oxuser__oxpassword = new oxField(crc32('*****@*****.**'), oxField::T_RAW); $oUser->oxuser__oxcustnr = new oxField($iLastCustNr + 1, oxField::T_RAW); $oUser->oxuser__oxcountryid = new oxField("testCountry", oxField::T_RAW); $oUser->save(); $sQ = 'insert into oxaddress ( oxid, oxuserid, oxaddressuserid, oxcountryid ) values ( "test_user", "' . $oUser->getId() . '", "' . $oUser->getId() . '", "testCountry" ) '; $myDB->Execute($sQ); oxTestModules::addFunction("oxUtils", "redirect", "{ throw new exception( 'testBlockedUser', 123 );}"); $oUser2 = oxNew('oxuser'); $oUser2->load($oUser->getId()); $oUser2->login('*****@*****.**', crc32('*****@*****.**')); $myDB = oxDb::getDB(); $sQ = 'insert into oxobject2group (oxid,oxshopid,oxobjectid,oxgroupsid) values ( "' . $oUser2->getId() . '", "' . $this->getConfig()->getShopId() . '", "' . $oUser2->getId() . '", "oxidblocked" )'; $myDB->Execute($sQ); try { $oUserView = oxNew('oxcmp_user'); $oUserView->init(); } catch (Exception $oE) { if ($oE->getCode() === 123) { $oUser2->logout(); return; } } $oUser->logout(); $this->fail('first assert should throw an exception'); }
public function testOxArticleGetSelectList() { $database = oxDb::getDB(); $config = $this->getConfig(); $currency = $config->getActShopCurrencyObject(); $shopId = $config->getBaseShopId(); $value = 'Опрос Žiniasklaidai Gästebuch!P!-5,99__Опрос Žiniasklaidai Gästebuch@@'; if ($this->getTestConfig()->getShopEdition() == 'EE') { $query = "insert into oxselectlist (oxid, oxmapid, oxshopid, oxtitle, oxident, oxvaldesc) values ('_testSellisttest', '777', '{$shopId}', 'Опрос Žiniasklaidai Gästebuch', '_testSellisttest', '{$value}')"; $database->execute($query); $query = "insert into oxselectlist2shop (oxmapobjectid, oxshopid ) values ('777', '{$shopId}')"; $database->execute($query); } else { $query = "insert into oxselectlist (oxid, oxshopid, oxtitle, oxident, oxvaldesc) values ('_testSellisttest', '{$shopId}', 'Опрос Žiniasklaidai Gästebuch', '_testSellisttest', '{$value}')"; $database->execute($query); } $query = 'insert into oxobject2selectlist (oxid, oxobjectid, oxselnid, oxsort) values ("_testSellisttest", "1651", "_testSellisttest", 1) '; $database->execute($query); $this->getConfig()->setConfigParam('bl_perfLoadSelectLists', true); $this->getConfig()->setConfigParam('bl_perfUseSelectlistPrice', true); $object = new stdClass(); $object->price = '-5.99'; $object->fprice = '-5,99'; $object->priceUnit = 'abs'; $object->name = 'Опрос Žiniasklaidai Gästebuch -5,99 ' . $currency->sign; $object->value = 'Опрос Žiniasklaidai Gästebuch'; $selectionList[] = $object; $expected[0] = $selectionList; $expected[0]['name'] = 'Опрос Žiniasklaidai Gästebuch'; $article = oxNew('oxArticle'); $article->load('1651'); $this->assertEquals($expected, $article->getSelectLists()); }
/** * Searches for attribute by oxtitle. If exists returns attribute id * * @param string $sSelTitle selection list title * * @return mixed attribute id or false */ protected function _getAttrId($sSelTitle) { $oDb = oxDb::getDB(); $sAttViewName = getViewName('oxattribute'); return $oDb->getOne("select oxid from {$sAttViewName} where LOWER(oxtitle) = " . $oDb->quote(getStr()->strtolower($sSelTitle))); }
/** * Adds data to _aViewData for later use in templates. * * @param oxArticle $article */ protected function prepareBundledArticlesDataForView($article) { $database = oxDb::getDB(); $config = $this->getConfig(); $articleTable = getViewName('oxarticles', $this->_iEditLang); $query = "select {$articleTable}.oxtitle, {$articleTable}.oxartnum, {$articleTable}.oxvarselect " . "from {$articleTable} where 1 "; // #546 $isVariantSelectionEnabled = $config->getConfigParam('blVariantsSelection'); $bundleIdField = 'oxarticles__oxbundleid'; $query .= $isVariantSelectionEnabled ? '' : " and {$articleTable}.oxparentid = '' "; $query .= " and {$articleTable}.oxid = " . $database->quote($article->{$bundleIdField}->value); $resultFromDatabase = $database->Execute($query); if ($resultFromDatabase != false && $resultFromDatabase->RecordCount() > 0) { while (!$resultFromDatabase->EOF) { $articleNumber = new oxField($resultFromDatabase->fields[1]); $articleTitle = new oxField($resultFromDatabase->fields[0] . " " . $resultFromDatabase->fields[2]); $resultFromDatabase->MoveNext(); } } $this->_aViewData['bundle_artnum'] = $articleNumber; $this->_aViewData['bundle_title'] = $articleTitle; }
/** * Test assign. */ public function testAssign() { $oBase = new _oxBase(); $oBase->init("oxactions"); $select = "select * from oxactions where oxid = 'oxstart'"; $oDB = oxDb::getDB(oxDB::FETCH_MODE_ASSOC); $rs = $oDB->execute($select); $oBase->assign($rs->fields); $this->assertEquals("oxstart", $oBase->getId()); }
public function testGetLinkSeoEngWithLangParam() { $myConfig = $this->getConfig(); $myDB = oxDb::getDB(); oxTestModules::addFunction("oxutilsserver", "getServerVar", "{ \$aArgs = func_get_args(); if ( \$aArgs[0] === 'HTTP_HOST' ) { return '" . $this->getConfig()->getShopUrl() . "'; } elseif ( \$aArgs[0] === 'SCRIPT_NAME' ) { return ''; } else { return \$_SERVER[\$aArgs[0]]; } }"); oxTestModules::addFunction("oxutils", "seoIsActive", "{return true;}"); // fetching first vendor from db $sQ = 'select oxid from oxvendor where oxvendor.oxshopid = "' . $myConfig->getShopID() . '"'; $sVendorId = $myDB->getOne($sQ); $sQ = 'select oxtitle_1 from oxvendor where oxvendor.oxshopid = "' . $myConfig->getShopID() . '"'; $sVendorTitle = $myDB->getOne($sQ); $oVendor = oxNew('oxvendor'); $oVendor->loadInLang(0, $sVendorId); $this->assertEquals($this->getConfig()->getShopUrl() . 'en/By-Distributor/' . str_replace(' ', '-', $sVendorTitle) . '/', $oVendor->getLink(1)); }
/** * Test case for oxArticleList::updateUpcomingPrices() * Checks is oxvarminprice calculated correctly when there are no children and updatetime is yesterday */ public function testUpdateUpcomingPrices_VarMaxPriceWithNoChildAndUpdateTimeIsYesterday() { $oArticle = oxNew('oxArticle'); $oArticle->setId('_testParentArticle'); $oArticle->oxarticles__oxactive = new oxField(1, oxField::T_RAW); $oArticle->oxarticles__oxstock = new oxField(15, oxField::T_RAW); $oArticle->oxarticles__oxprice = new oxField(20, oxField::T_RAW); $sYesterday = date("Y-m-d H:i:s", oxRegistry::get("oxUtilsDate")->getTime() - 86400); $oArticle->oxarticles__oxupdatepricetime = new oxField($sYesterday); $oArticle->oxarticles__oxupdateprice = new oxField(30); $oArticle->save(); $oArticleList = oxNew('oxArticleList'); $oArticleList->updateUpcomingPrices(true); $sQ = "select oxvarmaxprice from oxarticles where oxid=?"; $iExpectedMaxPrice = 30; $this->assertEquals($iExpectedMaxPrice, (int) oxDb::getDB()->getOne($sQ, array("_testParentArticle"))); }
/** * Collects available article extended parameters, passes them to * Smarty engine and returns template file name "article_extend.tpl". * * @return string */ public function render() { parent::render(); $this->_aViewData['edit'] = $oArticle = oxNew('oxArticle'); $soxId = $this->getEditObjectId(); $this->_createCategoryTree("artcattree"); // all categories if ($soxId != "-1" && isset($soxId)) { // load object $oArticle->loadInLang($this->_iEditLang, $soxId); // load object in other languages $oOtherLang = $oArticle->getAvailableInLangs(); if (!isset($oOtherLang[$this->_iEditLang])) { $oArticle->loadInLang(key($oOtherLang), $soxId); } foreach ($oOtherLang as $id => $language) { $oLang = new stdClass(); $oLang->sLangDesc = $language; $oLang->selected = $id == $this->_iEditLang; $this->_aViewData["otherlang"][$id] = clone $oLang; } // variant handling if ($oArticle->oxarticles__oxparentid->value) { $oParentArticle = oxNew('oxArticle'); $oParentArticle->load($oArticle->oxarticles__oxparentid->value); $this->_aViewData["parentarticle"] = $oParentArticle; $this->_aViewData["oxparentid"] = $oArticle->oxarticles__oxparentid->value; } } $oDB = oxDb::getDB(); $myConfig = $this->getConfig(); $sArticleTable = getViewName('oxarticles', $this->_iEditLang); $sSelect = "select {$sArticleTable}.oxtitle, {$sArticleTable}.oxartnum, {$sArticleTable}.oxvarselect " . "from {$sArticleTable} where 1 "; // #546 $blVariantsSelectionParameter = $myConfig->getConfigParam('blVariantsSelection'); $sBundleIdField = 'oxarticles__oxbundleid'; $sSelect .= $blVariantsSelectionParameter ? '' : " and {$sArticleTable}.oxparentid = '' "; $sSelect .= " and {$sArticleTable}.oxid = " . $oDB->quote($oArticle->{$sBundleIdField}->value); $rs = $oDB->Execute($sSelect); if ($rs != false && $rs->RecordCount() > 0) { while (!$rs->EOF) { $sArtNum = new oxField($rs->fields[1]); $sArtTitle = new oxField($rs->fields[0] . " " . $rs->fields[2]); $rs->MoveNext(); } } $this->_aViewData['bundle_artnum'] = $sArtNum; $this->_aViewData['bundle_title'] = $sArtTitle; $iAoc = $this->getConfig()->getRequestParameter("aoc"); if ($iAoc == 1) { $oArticleExtendAjax = oxNew('article_extend_ajax'); $this->_aViewData['oxajax'] = $oArticleExtendAjax->getColumns(); return "popups/article_extend.tpl"; } elseif ($iAoc == 2) { $oArticleBundleAjax = oxNew('article_bundle_ajax'); $this->_aViewData['oxajax'] = $oArticleBundleAjax->getColumns(); return "popups/article_bundle.tpl"; } //load media files $this->_aViewData['aMediaUrls'] = $oArticle->getMediaUrls(); return "article_extend.tpl"; }
public function testUpdateArticleStock() { $oDB = oxDb::getDB(); $oDB->getOne("update oxarticles set oxtimestamp = '2005-03-24 14:33:53' where oxid = '_testArticleId'"); $this->_oOrderArticle->updateArticleStock(-3, false); $oArticle = oxNew("oxArticle"); $oArticle->load("_testArticleId"); $this->assertEquals(7, $oArticle->oxarticles__oxstock->value); $this->assertNotEquals('2005-03-24 14:33:53', $oDB->getOne("select oxtimestamp from oxarticles where oxid = '_testArticleId'")); }
/** * Tear down the fixture. * * @return null */ protected function tearDown() { oxDb::getDB()->execute("delete from oxaddress where OXID = '_testUserAddressId' "); parent::tearDown(); }
/** * Collects available article axtended parameters, passes them to * Smarty engine and returns tamplate file name "article_extend.tpl". * * @return string */ public function render() { parent::render(); $this->_aViewData['edit'] = $oArticle = oxNew('oxarticle'); $soxId = $this->getEditObjectId(); $sCatView = getViewName('oxcategories'); $sChosenArtCat = $this->_getCategoryTree("artcattree", oxConfig::getParameter("artcat")); // all categories if ($soxId != "-1" && isset($soxId)) { // load object $oArticle->loadInLang($this->_iEditLang, $soxId); // load object in other languages $oOtherLang = $oArticle->getAvailableInLangs(); if (!isset($oOtherLang[$this->_iEditLang])) { // echo "language entry doesn't exist! using: ".key($oOtherLang); $oArticle->loadInLang(key($oOtherLang), $soxId); } foreach ($oOtherLang as $id => $language) { $oLang = new oxStdClass(); $oLang->sLangDesc = $language; $oLang->selected = $id == $this->_iEditLang; $this->_aViewData["otherlang"][$id] = clone $oLang; } // variant handling if ($oArticle->oxarticles__oxparentid->value) { $oParentArticle = oxNew('oxarticle'); $oParentArticle->load($oArticle->oxarticles__oxparentid->value); $oArticle->oxarticles__oxnonmaterial = new oxField($oParentArticle->oxarticles__oxnonmaterial->value); $oArticle->oxarticles__oxfreeshipping = new oxField($oParentArticle->oxarticles__oxfreeshipping->value); $this->_aViewData["parentarticle"] = $oParentArticle; $this->_aViewData["oxparentid"] = $oArticle->oxarticles__oxparentid->value; } $sO2CView = getViewName('oxobject2category'); } $oDB = oxDb::getDB(); $myConfig = $this->getConfig(); $sArticleTable = getViewName('oxarticles', $this->_iEditLang); $sSelect = "select {$sArticleTable}.oxtitle, {$sArticleTable}.oxartnum, {$sArticleTable}.oxvarselect from {$sArticleTable} where 1 "; // #546 $sSelect .= $myConfig->getConfigParam('blVariantsSelection') ? '' : " and {$sArticleTable}.oxparentid = '' "; $sSelect .= " and {$sArticleTable}.oxid = " . $oDB->quote($oArticle->oxarticles__oxbundleid->value); $rs = $oDB->Execute($sSelect); if ($rs != false && $rs->RecordCount() > 0) { while (!$rs->EOF) { $sArtNum = new oxField($rs->fields[1]); $sArtTitle = new oxField($rs->fields[0] . " " . $rs->fields[2]); $rs->MoveNext(); } } $this->_aViewData['bundle_artnum'] = $sArtNum; $this->_aViewData['bundle_title'] = $sArtTitle; $aColumns = array(); $iAoc = oxConfig::getParameter("aoc"); if ($iAoc == 1) { include_once 'inc/' . strtolower(__CLASS__) . '.inc.php'; $this->_aViewData['oxajax'] = $aColumns; return "popups/article_extend.tpl"; } elseif ($iAoc == 2) { include_once 'inc/article_bundle.inc.php'; $this->_aViewData['oxajax'] = $aColumns; return "popups/article_bundle.tpl"; } //load media files $this->_aViewData['aMediaUrls'] = $oArticle->getMediaUrls(); return "article_extend.tpl"; }