SeemsUtf8.php 988 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * @group formatting
  4. */
  5. class Tests_Formatting_SeemsUtf8 extends WP_UnitTestCase {
  6. /**
  7. * `seems_utf8` returns true for utf-8 strings, false otherwise.
  8. *
  9. * @dataProvider utf8_strings
  10. */
  11. function test_returns_true_for_utf8_strings( $utf8_string ) {
  12. // from http://www.i18nguy.com/unicode-example.html
  13. $this->assertTrue( seems_utf8( $utf8_string ) );
  14. }
  15. function utf8_strings() {
  16. $utf8_strings = file( DIR_TESTDATA . '/formatting/utf-8/utf-8.txt' );
  17. foreach ( $utf8_strings as &$string ) {
  18. $string = (array) trim( $string );
  19. }
  20. unset( $string );
  21. return $utf8_strings;
  22. }
  23. /**
  24. * @dataProvider big5_strings
  25. */
  26. function test_returns_false_for_non_utf8_strings( $big5_string ) {
  27. $this->markTestIncomplete( 'This test does not have any assertions.' );
  28. $big5 = $big5[0];
  29. $strings = array(
  30. "abc",
  31. "123",
  32. $big5
  33. );
  34. }
  35. function big5_strings() {
  36. // Get data from formatting/big5.txt
  37. return array( array( 'incomplete' ) );
  38. }
  39. }