public function testPrepareUriFiltersRootFilesAndReservedKeywords() { oxTestModules::publicize('oxSeoEncoder', '_prepareUri'); oxTestModules::addFunction('oxSeoEncoder', '_trimUrl', '{return ltrim($aA[0], "u");}'); $oDb = modDB::getInstance(); $oDb->addClassFunction('GetOne', array($this, '__SaveToDbCreatesGoodMd5Callback')); $iShopId = $this->getConfig()->getBaseShopId(); $oE = oxNew('oxseoencoder'); $this->aSQL = array(); $this->aRET = array(false); $this->assertEquals('admin-oxid/aa.html', $oE->p_prepareUri('admin/aa.html'), ''); $oE = oxNew('oxseoencoder'); $this->aSQL = array(); $this->aRET = array(false); $this->assertEquals('index-php/aa/', $oE->p_prepareUri('index.php/aa'), ''); $oE = oxNew('oxseoencoder'); $this->aSQL = array(); $this->aRET = array(false); $this->assertEquals('index-php/', $oE->p_prepareUri('index.php'), ''); $oE = oxNew('oxseoencoder'); $this->aSQL = array(); $this->aRET = array(false); $this->assertEquals('/index-oxid/aa.html', $oE->p_prepareUri('/index/aa.html'), ''); $oE = oxNew('oxseoencoder'); $this->aSQL = array(); $this->aRET = array(false); $this->assertEquals('/index-php/aa.html', $oE->p_prepareUri('/index.php/aa.html'), ''); $oE = oxNew('oxseoencoder'); $this->aSQL = array(); $this->aRET = array(false); $this->assertEquals('/index-oxid/', $oE->p_prepareUri('/index/'), ''); $oE = oxNew('oxseoencoder'); $this->aSQL = array(); $this->aRET = array(false); $this->assertEquals('/index-oxid/', $oE->p_prepareUri('/index'), ''); $oE = oxNew('oxseoencoder'); $this->aSQL = array(); $this->aRET = array(false); $this->assertEquals('index-oxid/', $oE->p_prepareUri('--index'), ''); $oE = oxNew('oxseoencoder'); $oE->setSeparator('/'); $this->aSQL = array(); $this->aRET = array(false); $this->assertEquals('/index_oxid/aa.html', $oE->p_prepareUri('/index/aa.html'), ''); $cl = oxTestModules::addFunction('oxSeoEncoder', 'clean_aReservedEntryKeys', '{oxSeoEncoder::$_aReservedEntryKeys = null;}'); $oE = new $cl(); $oE->clean_aReservedEntryKeys(); $oE->setReservedWords(array('keyword1', 'keyword2')); $oE->setSeparator('+'); $this->aSQL = array(); $this->aRET = array(false); $this->assertEquals('/keyword1+oxid/keyword1+s+keyword2/aa+keyword1.html', $oE->p_prepareUri('/keyword1/keyword1-s.keyword2/aa-keyword1.html'), ''); $this->assertEquals('/keyword2+oxid/', $oE->p_prepareUri('/keyword2'), ''); }
/** * Article_Review::_getReviewList() test case * * @return null */ public function testGetReviewList() { $articleVariantId = $this->getTestArticleVariantId(); oxDb::getDb()->execute('replace into oxreviews (OXID, OXACTIVE, OXOBJECTID, OXTYPE, OXTEXT, OXUSERID, OXCREATE, OXLANG, OXRATING) values ("_test_i2", 1, "' . $articleVariantId . '", "oxarticle", "aa", "' . oxADMIN_LOGIN . '", "0000-00-00 00:00:00", "0", "3")'); oxTestModules::publicize('article_review', '_getReviewList'); $o = oxNew('article_review'); $oA = oxNew('oxArticle'); $oA->load($this->getTestArticleId()); $this->getConfig()->setConfigParam('blShowVariantReviews', false); $this->assertEquals(1, count($o->p_getReviewList($oA))); $this->getConfig()->setConfigParam('blShowVariantReviews', true); $this->assertEquals(2, count($o->p_getReviewList($oA))); }
public function testGetPictureInfoNotFound() { $oCfg = $this->getMock('oxConfig', array('getPicturePath', 'getOutDir', 'getOutUrl')); $oCfg->expects($this->once())->method('getPicturePath')->will($this->returnValue(false)); $oCfg->expects($this->never())->method('getOutDir'); $oCfg->expects($this->never())->method('getOutUrl'); $cl = oxTestModules::publicize('oxPictureHandler', '_getPictureInfo'); $oPicHandler = $this->getMock($cl, array('getConfig')); $oPicHandler->expects($this->any())->method('getConfig')->will($this->returnValue($oCfg)); $this->assertEquals(array('path' => false, 'url' => false), $oPicHandler->p_getPictureInfo('master/product/', 'nopic.jpg')); }
public function testGetSearchParamsUrl() { oxTestModules::addFunction('oxLang', 'getBaseLanguage', '{return 5;}'); oxTestModules::addFunction('oxLang', 'translateString', '{return $aA[0]."%s";}'); oxTestModules::publicize('oxrssfeed', '_getSearchParamsUrl'); $oRss = oxNew('oxRssFeed'); $this->assertEquals('searchparam=a+a', $oRss->p_getSearchParamsUrl('a a', '', '', '')); $this->assertEquals('searchparam=+a&searchcnid=b+', $oRss->p_getSearchParamsUrl(' a', 'b ', '', '')); $this->assertEquals('searchparam=+a&searchcnid=b+&searchvendor=+c', $oRss->p_getSearchParamsUrl(' a', 'b ', ' c', '')); $this->assertEquals('searchparam=+a&searchvendor=+c', $oRss->p_getSearchParamsUrl(' a', '', ' c', '')); $this->assertEquals('searchparam=+a&searchmanufacturer=+d+', $oRss->p_getSearchParamsUrl(' a', '', '', ' d ')); }
/** * _unserializeConfVar test * * @return null */ public function testUnserializeConfVar() { $sCl = oxTestModules::publicize('Shop_Config', '_unserializeConfVar'); $oTest = new $sCl(); $this->assertEquals('1.1', $oTest->p_unserializeConfVar('str', 'iMinOrderPrice', '1,1')); $this->assertEquals('2,2', $oTest->p_unserializeConfVar('str', 'shouldNotChange', '2,2')); }