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/HtmlTest.php
<?php
/**
 * @group utils
 * @group html
 */
class HtmlTest extends PHPUnit_Framework_TestCase {

    
    public function testUsersLink(){
        $text = 'Hi @timwhitlock!';
        $html = twitter_api_html( $text );
        $want = 'Hi <a class="twitter-screen-name" href="https://twitter.com/timwhitlock" target="_blank" rel="nofollow">@timwhitlock</a>!';
        $this->assertEquals( $want, $html );
    }    


    public function testUsersLinkWithEntities(){
        $text = '@ignore @timwhitlock!';
        $mock = array( 'user_mentions' => array (
            array( 'screen_name' => 'timwhitlock', 'indices' => '_ignored_' ),
        ) );
        $html = twitter_api_html_with_entities( $text, $mock );
        $want = '@ignore <a class="twitter-screen-name" href="https://twitter.com/timwhitlock" target="_blank" rel="nofollow">&#x40;timwhitlock</a>!';
        $this->assertEquals( $want, $html );
    }


    public function testHashtag(){
        $text = 'Foo #Bar!';
        $html = twitter_api_html( $text );
        $want = 'Foo <a class="twitter-hashtag" href="https://twitter.com/search?q=%23Bar&amp;src=hash" target="_blank" rel="nofollow">#Bar</a>!';
        $this->assertEquals( $want, $html );
    }    


    public function testHashtagWithEntities(){
        $text = 'Foo #Bar! #ignore';
        $mock = array( 'hashtags' => array (
            array( 'text' => 'Bar!', 'indices' => '_ignored_' ),
        ) );
        $html = twitter_api_html_with_entities( $text, $mock );
        $want = 'Foo <a class="twitter-hashtag" href="https://twitter.com/search?q=%23Bar%21&amp;src=hash" target="_blank" rel="nofollow">&#x23;Bar!</a> #ignore';
        $this->assertEquals( $want, $html );
    }    
    
    
    

}