wordpress-develop/tests/phpunit/tests/formatting/Emoji.php
Gary Pendergast f881c4e646 Emoji: Update some failing unit tests.
The changes in [38717] weren't reflected in the associated unit tests.

See #38113.



git-svn-id: https://develop.svn.wordpress.org/trunk@38724 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-04 10:37:59 +00:00

69 lines
2.0 KiB
PHP

<?php
/**
* @group formatting
*/
class Tests_Formatting_Emoji extends WP_UnitTestCase {
/**
* @ticket 36525
*/
public function test_unfiltered_emoji_cdns() {
$png_cdn = 'https://s.w.org/images/core/emoji/2.2.1/72x72/';
$svn_cdn = 'https://s.w.org/images/core/emoji/2.2.1/svg/';
$output = get_echo( '_print_emoji_detection_script' );
$this->assertContains( wp_json_encode( $png_cdn ), $output );
$this->assertContains( wp_json_encode( $svn_cdn ), $output );
}
public function _filtered_emoji_svn_cdn( $cdn = '' ) {
return 'https://s.wordpress.org/images/core/emoji/svg/';
}
/**
* @ticket 36525
*/
public function test_filtered_emoji_svn_cdn() {
$png_cdn = 'https://s.w.org/images/core/emoji/2.2.1/72x72/';
$svn_cdn = 'https://s.w.org/images/core/emoji/2.2.1/svg/';
$filtered_svn_cdn = $this->_filtered_emoji_svn_cdn();
add_filter( 'emoji_svg_url', array( $this, '_filtered_emoji_svn_cdn' ) );
$output = get_echo( '_print_emoji_detection_script' );
$this->assertContains( wp_json_encode( $png_cdn ), $output );
$this->assertNotContains( wp_json_encode( $svn_cdn ), $output );
$this->assertContains( wp_json_encode( $filtered_svn_cdn ), $output );
remove_filter( 'emoji_svg_url', array( $this, '_filtered_emoji_svn_cdn' ) );
}
public function _filtered_emoji_png_cdn( $cdn = '' ) {
return 'https://s.wordpress.org/images/core/emoji/png_cdn/';
}
/**
* @ticket 36525
*/
public function test_filtered_emoji_png_cdn() {
$png_cdn = 'https://s.w.org/images/core/emoji/2.2.1/72x72/';
$svn_cdn = 'https://s.w.org/images/core/emoji/2.2.1/svg/';
$filtered_png_cdn = $this->_filtered_emoji_png_cdn();
add_filter( 'emoji_url', array( $this, '_filtered_emoji_png_cdn' ) );
$output = get_echo( '_print_emoji_detection_script' );
$this->assertContains( wp_json_encode( $filtered_png_cdn ), $output );
$this->assertNotContains( wp_json_encode( $png_cdn ), $output );
$this->assertContains( wp_json_encode( $svn_cdn ), $output );
remove_filter( 'emoji_url', array( $this, '_filtered_emoji_png_cdn' ) );
}
}