Exemple #1
0
 /**
  * Tries to match a smiley with a set of emoticons.
  *
  * @param string $smiley The smiley
  *
  * @return array An array of parameters
  */
 public function match($smiley)
 {
     $emoticon = $this->emoticons->getEmoticonBySmiley($smiley);
     if (null === $emoticon) {
         return array();
     }
     return array('xHtml' => $emoticon->getXhtml(), 'html' => $emoticon->getHtml());
 }
 public function testAddOverriddenSmiley()
 {
     $collection = new EmoticonCollection();
     $emoticon = new Emoticon();
     $emoticon->setSmilies(array(':foo:', ':foofoo:'));
     $emoticon1 = new Emoticon();
     $emoticon1->setSmilies(array(':foo:', ':bar:'));
     $collection->add('foo', $emoticon);
     $collection->add('bar', $emoticon1);
     $this->assertSame(array(':foofoo:', ':foo:', ':bar:'), $collection->getSmilies());
     $this->assertSame($emoticon, $collection->getEmoticonBySmiley(':foofoo:'));
     $this->assertSame($emoticon1, $collection->getEmoticonBySmiley(':foo:'));
     $this->assertSame($emoticon1, $collection->getEmoticonBySmiley(':bar:'));
 }