WordPress.org

Make WordPress Core

Ticket #25529: 25529.tests.diff

File 25529.tests.diff, 982 bytes (added by simonwheatley, 8 years ago)

Tests for translate_smiley escaping the URL (actually the right tests now)

  • tests/phpunit/tests/formatting/TranslateSmiley.php

     
     1<?php
     2
     3/**
     4 * @group formatting
     5 */
     6class Tests_Formatting_TranslateSmiley extends WP_UnitTestCase {
     7
     8        function test_translate_smiley_escapes_url() {
     9                $url    = includes_url( 'images/smilies/icon_smile.gif" onclick="alert();"' );
     10                $GLOBALS[ 'wpsmiliestrans' ][ ':)' ] = 'icon_smile.gif" onclick="alert();"';
     11                $expected = sprintf( ' <img src="%s" alt=":)" class="wp-smiley" /> ', esc_url( $url ) );
     12
     13                $this->assertEquals($expected, translate_smiley(array(':)')));
     14        }
     15
     16}