mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
Note: This is enforced by WPCS 3.0.0. Props jrf. See #59161, #58831. git-svn-id: https://develop.svn.wordpress.org/trunk@56536 602fd350-edb4-49c9-b593-d223f7449a82
46 lines
1.2 KiB
PHP
46 lines
1.2 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @group formatting
|
|
*
|
|
* @covers ::seems_utf8
|
|
*/
|
|
class Tests_Formatting_SeemsUtf8 extends WP_UnitTestCase {
|
|
|
|
/**
|
|
* `seems_utf8` returns true for utf-8 strings, false otherwise.
|
|
*
|
|
* @dataProvider data_seems_utf8_returns_true_for_utf8_strings
|
|
*/
|
|
public function test_seems_utf8_returns_true_for_utf8_strings( $utf8_string ) {
|
|
// From http://www.i18nguy.com/unicode-example.html
|
|
$this->assertTrue( seems_utf8( $utf8_string ) );
|
|
}
|
|
|
|
public function data_seems_utf8_returns_true_for_utf8_strings() {
|
|
$utf8_strings = file( DIR_TESTDATA . '/formatting/utf-8/utf-8.txt' );
|
|
foreach ( $utf8_strings as &$string ) {
|
|
$string = (array) trim( $string );
|
|
}
|
|
unset( $string );
|
|
return $utf8_strings;
|
|
}
|
|
|
|
/**
|
|
* @dataProvider data_seems_utf8_returns_false_for_non_utf8_strings
|
|
*/
|
|
public function test_seems_utf8_returns_false_for_non_utf8_strings( $big5_string ) {
|
|
$this->assertFalse( seems_utf8( $big5_string ) );
|
|
}
|
|
|
|
public function data_seems_utf8_returns_false_for_non_utf8_strings() {
|
|
// Get data from formatting/big5.txt.
|
|
$big5_strings = file( DIR_TESTDATA . '/formatting/big5.txt' );
|
|
foreach ( $big5_strings as &$string ) {
|
|
$string = (array) trim( $string );
|
|
}
|
|
unset( $string );
|
|
return $big5_strings;
|
|
}
|
|
}
|