public function testaListPrepareMetaKeyword() { $aSubCats[0] = new oxcategory(); $aSubCats[0]->oxcategories__oxtitle = new oxField('agentū Литовfür sub_category_1'); $aSubCats[1] = new oxcategory(); $aSubCats[1]->oxcategories__oxtitle = new oxField('agentū Литовfür Nada fedia nada'); $oParentCategory = new oxcategory(); $oParentCategory->oxcategories__oxtitle = new oxField('agentū Литовfür parent_category'); $oCategory = new oxcategory(); $oCategory->oxcategories__oxtitle = new oxField('current_category'); $oCategory->oxcategories__oxparentid = new oxField('parentCategoryId'); $oCategory->setSubCats($aSubCats); $oCategory->setParentCategory($oParentCategory); $aCatTree[] = $oParentCategory; $aCatTree[] = $oCategory; $oCategoryTree = $this->getMock('oxcategorylist', array('getPath')); $oCategoryTree->expects($this->any())->method('getPath')->will($this->returnValue($aCatTree)); $oListView = $this->getMock('alist', array('getActiveCategory', 'getCategoryTree')); $oListView->expects($this->any())->method('getActiveCategory')->will($this->returnValue($oCategory)); $oListView->expects($this->any())->method('getCategoryTree')->will($this->returnValue($oCategoryTree)); $this->assertEquals('agentū, литовfür, parent_category, current_category, sub_category_1, nada, fedia', $oListView->UNITprepareMetaKeyword(null)); }
/** * sets a single category, handles sorting and parent hasVisibleSubCats * * @param oxcategory $oCat the category * @param string $sKey (optional, default=null) the key for that category, without a key, the category isjust added to the array * @param boolean $blSkipSorting (optional, default=false) should we skip sorting now? (deprecated on 2011.01.27 for v4.5.0) * * @return null */ public function setSubCat($oCat, $sKey = null, $blSkipSorting = false) { if ($sKey) { $this->_aSubCats[$sKey] = $oCat; } else { $this->_aSubCats[] = $oCat; } // keeping ref. to parent $oCat->setParentCategory($this); if ($oCat->getIsVisible()) { $this->setHasVisibleSubCats(true); } }