Exemple #1
1
 /**
  * test shouldn't replace an ascii smiley in a URL (shouldn't replace :/)
  *
  * @return void
  */
 public function testSmileyInAnUrl()
 {
     // enable ASCII conversion
     $default_ascii = Emojione::$ascii;
     Emojione::$ascii = true;
     $ascii = 'Check out http://www.emojione.com';
     $this->assertEquals(Emojione::shortnameToImage($ascii), $ascii);
     $this->assertEquals(Emojione::toImage($ascii), $ascii);
     $this->assertEquals(Emojione::shortnameToAscii($ascii), $ascii);
     $this->assertEquals(Emojione::unifyUnicode($ascii), $ascii);
     // back to default ASCII conversion
     Emojione::$ascii = $default_ascii;
 }
Exemple #2
0
 public function showBody()
 {
     \Emojione\Emojione::$ascii = true;
     \Emojione\Emojione::$imagePathPNG = '/components/emojione/assets/png/';
     \Emojione\Emojione::$cacheBustParam = '';
     $data = \Emojione\Emojione::toImage(nl2br(htmlspecialchars($this->body)));
     return embedYoutubeForComment($data);
 }
Exemple #3
0
 /**
  * test all Emojis and shortcodes
  *
  * @dataProvider emojiProvider
  *
  * @return void
  */
 public function testEmojis($shortname, $simple_unicode)
 {
     $shortcode_replace = Emojione::getClient()->getRuleset()->getShortcodeReplace();
     $unicode_replace = Emojione::getClient()->getRuleset()->getUnicodeReplace();
     $unicode = Emojione::shortnameToUnicode($shortname);
     $this->assertNotTrue($unicode === $shortname);
     $this->assertTrue(isset($shortcode_replace[$shortname]));
     $this->assertEquals($shortcode_replace[$shortname], $simple_unicode);
     $this->assertTrue(in_array($unicode, $unicode_replace));
     $this->assertEquals($unicode_replace[$shortname], $unicode);
     $convert_unicode = strtolower(Emojione::convert($simple_unicode));
     $image_template = '<img class="emojione" alt="%1$s" src="//cdn.jsdelivr.net/emojione/assets/png/%2$s.png' . $this->cacheBustParam . '"/>';
     $image = sprintf($image_template, $convert_unicode, $simple_unicode);
     $this->assertEquals(Emojione::toImage($shortname), $image);
 }
Exemple #4
0
 /**
  * test Emojione::toImage()
  *
  * @return void
  */
 public function testToImage()
 {
     $test = 'Hello world! 😄 :smile:';
     $expected = 'Hello world! <img class="emojione" alt="😄" src="//cdn.jsdelivr.net/emojione/assets/png/1F604.png' . $this->cacheBustParam . '"/> <img class="emojione" alt="&#x1f604;" src="//cdn.jsdelivr.net/emojione/assets/png/1F604.png' . $this->cacheBustParam . '"/>';
     $this->assertEquals(Emojione::toImage($test), $expected);
 }
Exemple #5
0
 /**
  * test Emojione::toImage()
  *
  * @return void
  */
 public function testToImage()
 {
     $test = 'Hello world! 😄 :smile:';
     $expected = 'Hello world! <span class="emojione-1F604" title=":smile:">😄</span> <span class="emojione-1F604" title=":smile:">&#x1f604;</span>';
     $this->assertEquals(Emojione::toImage($test), $expected);
 }