/** * Tear down the fixture. * * @return null */ protected function tearDown() { oxRemClassModule('modoxdeliverylist_oxorder'); $this->cleanUpTable('oxorder'); $this->cleanUpTable('oxorderarticles'); $this->cleanUpTable('oxdeliveryset'); $this->cleanUpTable('oxpayments'); $this->cleanUpTable('oxwrapping'); $this->cleanUpTable('oxarticles'); $this->cleanUpTable('oxorderarticles'); $this->cleanUpTable('oxuserbaskets'); $this->cleanUpTable('oxuserbaskets', 'oxuserid'); $this->cleanUpTable('oxuserbasketitems'); $this->cleanUpTable('oxarticles'); $this->cleanUpTable('oxpayments'); $this->cleanUpTable('oxuser'); $this->cleanUpTable('oxdelivery'); $this->cleanUpTable('oxdiscount'); $this->cleanUpTable('oxobject2discount'); $this->cleanUpTable('oxdel2delset'); $this->cleanUpTable('oxobject2delivery'); $this->cleanUpTable('oxselectlist'); $this->cleanUpTable('oxobject2selectlist'); $this->cleanUpTable('oxorderarticles', 'oxorderid'); $this->cleanUpTable('oxuserpayments', 'oxuserid'); $this->cleanUpTable('oxvouchers'); $this->cleanUpTable('oxvouchers', 'oxorderid'); $this->cleanUpTable('oxvoucherseries'); $oDb = oxDb::getDb(); $oDb->execute("delete from oxuserbasketitems"); $oDb->execute("delete from oxuserbaskets"); oxArticleHelper::cleanup(); parent::tearDown(); }
/** * 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() { // deleting articles+variants if ($this->oArticle) { $this->oArticle->delete(); $this->oArticle = null; } // deleting category if ($this->oCategory) { $this->oCategory->delete(); $this->oCategory = null; } // deleting selection lists if ($this->oSelList) { $this->oSelList->delete(); $this->oSelList = null; } // deleting delivery address info if ($this->oDelAdress) { $this->oDelAdress->delete(); $this->oDelAdress = null; } // deleting demo wrapping if ($this->oCard) { $this->oCard->delete(); $this->oCard = null; } if ($this->oWrap) { $this->oWrap->delete(); $this->oWrap = null; } // deleting vouchers if ($this->aVouchers) { foreach ($this->aVouchers as $oVoucher) { $oVoucher->delete(); } $this->aVouchers = null; } if ($this->oVoucherSerie) { $this->oVoucherSerie->delete(); $this->oVoucherSerie = null; } // deleting discounts if ($this->aDiscounts) { foreach ($this->aDiscounts as $oDiscount) { $oDiscount->delete(); } $this->aDiscounts = null; } $this->oVariant = null; oxDb::getDb()->execute('delete from oxuserbaskets'); oxDb::getDb()->execute('delete from oxuserbasketitems'); $sName = $this->getName(); if ($sName == 'testBasketCalculationWithSpecUseCaseDescribedAbove' || $sName == 'testBasketCalculationWithSpecUseCaseDescribedAboveJustDiscountIsAppliedByPrice' || $sName == 'testUpdateBasketTwoProductsWithSameSelectionList') { $this->_cleanupDataAfterTestBasketCalculationWithSpecUseCaseDescribedAbove(); } $this->cleanUpTable('oxdiscount'); $this->cleanUpTable('oxartextends'); $this->cleanUpTable('oxseo', 'oxobjectid'); $this->cleanUpTable('oxprice2article'); $this->cleanUpTable('oxobject2discount'); $this->addTableForCleanup('oxarticles'); $this->addTableForCleanup('oxseo'); $this->addTableForCleanup('oxobject2selectlist'); $this->addTableForCleanup('oxselectlist'); $this->addTableForCleanup('oxselectlist2shop'); $this->addTableForCleanup('oxarticles2shop'); $this->addTableForCleanup('oxdiscount2shop'); oxArticleHelper::cleanup(); $this->getConfig()->setConfigParam('bl_perfLoadSelectLists', $this->blPerfLoadSelectLists); parent::tearDown(); }
/** * Test has amount price * * @return null */ public function testHasAmountPrice() { oxArticleHelper::resetAmountPrice(); // assign scale price Amount 2-2 Price 11.95 $oPrice2Prod = oxNew('oxBase'); $oPrice2Prod->init('oxprice2article'); $oPrice2Prod->setId('_testPrice2article'); $oPrice2Prod->oxprice2article__oxshopid = new oxField($this->getConfig()->getBaseShopId()); $oPrice2Prod->oxprice2article__oxartid = new oxField("1126"); $oPrice2Prod->oxprice2article__oxaddabs = new oxField(17); $oPrice2Prod->oxprice2article__oxamount = new oxField(2); $oPrice2Prod->oxprice2article__oxamountto = new oxField(2); $oPrice2Prod->save(); $oProduct = oxNew('oxArticle'); $oProduct->load("1126"); $this->assertTrue($oProduct->hasAmountPrice()); }
/** * Initialize the fixture. * * @return null */ protected function setUp() { parent::setUp(); // set to load full deliveries list $this->getConfig()->setConfigParam('bl_perfLoadDelivery', true); oxAddClassModule('oxDeliveryListTestClass', 'oxdeliverylist'); // inserting some demo data //set default user $this->_oUser = oxNew("oxuser"); $this->_oUser->setId('_testUserId'); $this->_oUser->oxuser__oxactive = new oxField('1', oxField::T_RAW); $this->_oUser->save(); //add user address $oAdress = oxNew('oxBase'); $oAdress->init('oxaddress'); $oAdress->setId('_testAddressId'); $oAdress->oxaddress__oxuserid = new oxField($this->_oUser->getId(), oxField::T_RAW); $oAdress->oxaddress__oxaddressuserid = new oxField($this->_oUser->getId(), oxField::T_RAW); $oAdress->oxaddress__oxcountryid = new oxField('a7c40f6323c4bfb36.59919433', oxField::T_RAW); //italien $oAdress->save(); $this->getSession()->setVariable('deladrid', '_testAddressId'); //add user to group $oO2Group = oxNew('oxBase'); $oO2Group->init('oxobject2group'); $oO2Group->setId('_testO2GId'); $oO2Group->oxobject2group__oxobjectid = new oxField('_testUserId', oxField::T_RAW); $oO2Group->oxobject2group__oxgroupsid = new oxField('oxidadmin', oxField::T_RAW); $oO2Group->save(); // delivery set $oDelSet = oxNew('oxdeliveryset'); $oDelSet->setId('_testDeliverySetId'); $oDelSet->oxdeliveryset__oxactive = new oxField(1, oxField::T_RAW); $oDelSet->save(); $this->_aDeliverySets[] = $oDelSet; // 1. creating category for test $oCategory = oxNew('oxCategory'); $oCategory->setId('_testCategoryId'); $oCategory->oxcategories__oxtitle = new oxField('_testCategoryTitle', oxField::T_RAW); $oCategory->oxcategories__oxactive = new oxField(1, oxField::T_RAW); $oCategory->oxcategories__oxshopid = new oxField($this->getConfig()->getBaseShopId(), oxField::T_RAW); $oCategory->oxcategories__oxhidden = new oxField(0, oxField::T_RAW); $oCategory->oxcategories__oxdefsortmode = new oxField(0, oxField::T_RAW); $oCategory->oxcategories__oxparentid = new oxField('oxrootid', oxField::T_RAW); $oCategory->save(); $this->_aCategories[] = $oCategory; //3. insert test articles for ($i = 1; $i <= 3; $i++) { $oArticle = oxNew("oxArticle"); $oArticle->setId('_testArticleId' . $i); $oArticle->oxarticles__oxtitle = new oxField('testArticle' . $i, oxField::T_RAW); $oArticle->oxarticles__oxartnum = new oxField(1000 + $i, oxField::T_RAW); $oArticle->oxarticles__oxshortdesc = new oxField('testArticle' . $i . 'Description', oxField::T_RAW); $oArticle->oxarticles__oxprice = new oxField('256', oxField::T_RAW); $oArticle->oxarticles__oxstock = new oxField('9', oxField::T_RAW); $oArticle->oxarticles__oxshopid = new oxField(1, oxField::T_RAW); $oArticle->save(); $this->_aTestProducts[] = $oArticle; // 2.1 assigning products to category $oO2Cat = oxNew('oxobject2category'); $oO2Cat->setId('_testO2CatId' . $i); $oO2Cat->oxobject2category__oxobjectid = new oxField($oArticle->getId(), oxField::T_RAW); $oO2Cat->oxobject2category__oxshopid = new oxField($this->getConfig()->getShopId(), oxField::T_RAW); $oO2Cat->oxobject2category__oxcatnid = new oxField($oCategory->getId(), oxField::T_RAW); $oO2Cat->save(); } // some deliveries for ($i = 1; $i <= 3; $i++) { $oDelivery = oxNew('oxDelivery'); $oDelivery->setId('_testDeliveryId' . $i); $oDelivery->oxdelivery__oxtitle = new oxField('_testDelivertTitle' . $i, oxField::T_RAW); $oDelivery->oxdelivery__oxactive = new oxField(1, oxField::T_RAW); $oDelivery->oxdelivery__oxdeltype = new oxField('p', oxField::T_RAW); $oDelivery->oxdelivery__oxparam = new oxField(0, oxField::T_RAW); $oDelivery->oxdelivery__oxparamend = new oxField(999999, oxField::T_RAW); $oDelivery->oxdelivery__oxaddsum = new oxField(100, oxField::T_RAW); $oDelivery->oxdelivery__oxfixed = new oxField(0, oxField::T_RAW); $oDelivery->oxdelivery__oxsort = new oxField(3 - $i, oxField::T_RAW); $oDelivery->oxdelivery__oxfinalize = new oxField(0, oxField::T_RAW); //$oDelivery->blForCat = true; $oDelivery->save(); $this->_aDeliveries[] = $oDelivery; $oDel2Delset = oxNew('oxBase'); $oDel2Delset->init('oxdel2delset'); $oDel2Delset->setId('_testDel2DelSetId' . $i); $oDel2Delset->oxdel2delset__oxdelid = new oxField($oDelivery->getId(), oxField::T_RAW); $oDel2Delset->oxdel2delset__oxdelsetid = new oxField($oDelSet->getId(), oxField::T_RAW); $oDel2Delset->save(); } oxArticleHelper::cleanup(); }
/** * Initialize the fixture. * * @return null */ protected function setUp() { parent::setUp(); oxAddClassModule('modOxDelivery', 'oxDelivery'); $this->cleanUpTable('oxdelivery'); $this->cleanUpTable('oxobject2delivery'); $this->cleanUpTable('oxarticles'); $this->aArticleIds = array(); $oDelivery = oxNew('oxDelivery'); $oDelivery->setId('_testDeliveryId'); $oDelivery->oxdelivery__oxtitle = new oxField('test_oxDelivery', oxField::T_RAW); $oDelivery->save(); $this->_sOxId = $oDelivery->getId(); // insert test articles for ($i = 1; $i <= 3; $i++) { $oArticle = oxNew("oxArticle"); $oArticle->setId('_testArticleId' . $i); $oArticle->oxarticles__oxtitle = new oxField('testArticle' . $i, oxField::T_RAW); $oArticle->oxarticles__oxartnum = new oxField(1000 + $i, oxField::T_RAW); $oArticle->oxarticles__oxshortdesc = new oxField('testArticle' . $i . 'Description', oxField::T_RAW); $oArticle->oxarticles__oxprice = new oxField('256', oxField::T_RAW); $oArticle->oxarticles__oxremindactive = new oxField('1', oxField::T_RAW); $oArticle->oxarticles__oxstock = new oxField('9', oxField::T_RAW); $oArticle->oxarticles__oxlength = new oxField('2', oxField::T_RAW); $oArticle->oxarticles__oxwidth = new oxField('4', oxField::T_RAW); $oArticle->oxarticles__oxheight = new oxField('6', oxField::T_RAW); $oArticle->oxarticles__oxweight = new oxField('5', oxField::T_RAW); $oArticle->save(); $this->aArticleIds[] = $oArticle->getId(); } // some demo data $sQ = 'insert into oxobject2delivery (`OXID`, `OXDELIVERYID`, `OXOBJECTID`, `OXTYPE`) values '; $sQ .= '("_testId1", "' . $this->_sOxId . '", "_testArticleId1", "oxarticles" ), '; $sQ .= '("_testId2", "' . $this->_sOxId . '", "_testArticleId2", "oxarticles" ), '; $sQ .= '("_testId3", "' . $this->_sOxId . '", "_testArticleId3", "oxarticles" )'; oxDb::getInstance()->getDb()->Execute($sQ); $sQ = 'insert into oxobject2delivery (`OXID`, `OXDELIVERYID`, `OXOBJECTID`, `OXTYPE`) values '; $sQ .= '("_testId4", "' . $this->_sOxId . '", "category_id1", "oxcategories" ), '; $sQ .= '("_testId5", "' . $this->_sOxId . '", "category_id2", "oxcategories" ), '; $sQ .= '("_testId6", "' . $this->_sOxId . '", "category_id3", "oxcategories" )'; oxDb::getInstance()->getDb()->Execute($sQ); $this->aCategoryIds = array("category_id1", "category_id2", "category_id3"); // preparing basket item $this->_oBasketItem = $this->getProxyClass("oxbasketitem"); $this->_oBasketItem->init('_testArticleId1', 2); $oPrice = oxNew('oxprice'); $oPrice->setPrice(256, 0); $this->_oBasketItem->setPrice($oPrice); oxArticleHelper::cleanup(); oxDeliveryHelper::cleanup(); }