Esempio n. 1
0
 /**
  * Testing tagset slicing
  *
  * @return null
  */
 public function testTagSetSlicing()
 {
     $oTagSet = oxNew('oxTagSet');
     $oTagSet->set("test1, test2, test2  , test1, test3 ");
     $oTagSet->slice(0, 2);
     $oTag1 = new oxTag("test1");
     $oTag1->setHitCount(2);
     $oTag2 = new oxTag("test2");
     $oTag2->setHitCount(2);
     $aTags = array("test1" => $oTag1, "test2" => $oTag2);
     $this->assertEquals($aTags, $oTagSet->get());
 }
Esempio n. 2
0
 /**
  * Compares two tags by hit count
  *
  * @param oxTag $oTag1 tag to compare
  * @param oxTag $oTag2 tag to compare
  *
  * @return int < 0 if tag1 is less than tag2; > 0 if tag1 is greater than tag2, and 0 if they are equal.
  */
 protected function _tagHitsCmp($oTag1, $oTag2)
 {
     return $oTag2->getHitCount() - $oTag1->getHitCount();
 }
Esempio n. 3
0
 /**
  * Returns tag hit count. Used for _getMaxHit array mapping
  *
  * @param oxTag $oTag tag object
  *
  * @return int
  */
 protected function _getTagHitCount($oTag)
 {
     return $oTag->getHitCount();
 }
Esempio n. 4
0
 /**
  * Testing add and remove dashes for tag
  *
  * @dataProvider testAddRemoveUnderscores_dataProvider
  *
  * @param string $sTag    tag to test
  * @param string $sResult expected result
  */
 public function testAddRemoveUnderscores($sTag, $sResult)
 {
     $oTag = new oxTag($sTag);
     $oTag->addUnderscores();
     $this->assertEquals($sResult, $oTag->get());
     $oTag->removeUnderscores();
     $this->assertEquals($sTag, $oTag->get());
 }