1<?php
2
3/**
4 * Test emoji substitution syntax
5 */
6class emoji_syntax_test extends DokuWikiTest {
7    function setup() {
8        $this->pluginsEnabled[] = 'emoji';
9        parent::setup();
10    }
11    function test_emoji_shortname() {
12        saveWikiText('emoji_page', ':smile:', 'Test');
13        $this->assertContains('<img class="emojione" alt="&#x1f604;" src="//cdn.jsdelivr.net/emojione/assets/png/1F604.png?v=1.2.4"/>', p_wiki_xhtml('emoji_page'),
14            'Emoji shortname does not convert.');
15    }
16    function test_emoji_unicode() {
17        saveWikiText('emoji_page', "\xF0\x9F\x98\x84", 'Test');
18        $this->assertContains("<img class=\"emojione\" alt=\"\xF0\x9F\x98\x84\" src=\"//cdn.jsdelivr.net/emojione/assets/png/1F604.png?v=1.2.4\"/>", p_wiki_xhtml('emoji_page'),
19            'Emoji code point does not convert.');
20    }
21    function test_emoji_smiley() {
22        saveWikiText('emoji_page', ':-)', 'Test');
23        $this->assertContains('<img class="emojione" alt="&#x1f604;" src="//cdn.jsdelivr.net/emojione/assets/png/1F604.png?v=1.2.4"/>', p_wiki_xhtml('emoji_page'),
24            'Emoji smiley does not convert.');
25    }
26}
27