HEX
Server:
System: Linux aac286ea486c 5.14.0-687.15.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jun 11 08:51:45 EDT 2026 x86_64
User: root (0)
PHP: 8.2.30
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,disk_free_space,diskfreespace
Upload Files
File: /dom877180/wp-content/plugins/latest-tweets-widget/api/test/utils/UnicodeTest.php
<?php
/**
 * @group utils
 * @group utf8
 */
class UnicodeTest extends PHPUnit_Framework_TestCase {
    
    public function testAsciiPassThrough(){
        $ints = twitter_api_utf8_array( 'abc' );
        $this->assertSame( array(97,98,99), $ints );
    }
    
    public function testAsciiPassthroughReverse(){
        $chr = twitter_api_utf8_chr( 97 );
        $this->assertSame( 'a', $chr );
    }
    

    public function testTwoByteCharacter(){
        // U+00A9 copyright symbol
        $text = "\xC2\xA9";
        $ints = twitter_api_utf8_array( $text );
        $this->assertCount( 1, $ints );
        $this->assertSame( 0x00A9, $ints[0] );
    }    
    
    
    public function testTwoByteCharacterReverse(){
        $chr = twitter_api_utf8_chr( 0x00A9 );
        $this->assertSame( "\xC2\xA9", $chr );
    }


    public function testThreeByteCharacter(){
        // U+2122 trademark symbol
        $text = "\xE2\x84\xA2";
        $ints = twitter_api_utf8_array( $text );
        $this->assertCount( 1, $ints );
        $this->assertSame( 0x2122, $ints[0] );
    }    
    

    public function testThreeByteCharacterReverse(){
        $chr = twitter_api_utf8_chr( 0x2122 );
        $this->assertSame( "\xE2\x84\xA2", $chr );
    }
    
    
    public function testFourByteCharacter(){
        // mahjong tile red dragon
        $text = "\xF0\x9F\x80\x84";
        $ints = twitter_api_utf8_array( $text );
        $this->assertCount( 1, $ints );
        $this->assertSame( 0x1F004, $ints[0] );
    }
    
    
    public function testFourByteCharacterReverse(){
        $chr = twitter_api_utf8_chr( 0x1F004 );
        $this->assertSame( "\xF0\x9F\x80\x84", $chr );
    }


    public function testVariableByteLengthMixed(){
        $ints = twitter_api_utf8_array("A\xC2\xA9B\xE2\x84\xA2C\xF0\x9F\x80\x84D");
        $this->assertSame( array( ord('A'), 0xA9, ord('B'), 0x2122, ord('C'), 0x1F004, ord('D') ), $ints );
    }
    
    
    public function testHexCodesCorrectLengthAndCase(){
        $text = twitter_api_unicode_implode( array( 0x97, 0xA9, 0x2122, 0x1F004 ) );
        $this->assertSame( '0097-00a9-2122-1f004', $text );
    }
    
    
}