Changeset 52010 for trunk/tests/phpunit/tests/db/charset.php
- Timestamp:
- 11/04/2021 03:22:47 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/db/charset.php
r51568 r52010 36 36 * @ticket 21212 37 37 */ 38 function data_strip_invalid_text() {38 public function data_strip_invalid_text() { 39 39 $fields = array( 40 40 'latin1' => array( … … 480 480 * @covers wpdb::strip_invalid_text 481 481 */ 482 function test_strip_invalid_text( $data, $expected, $message ) {482 public function test_strip_invalid_text( $data, $expected, $message ) { 483 483 $charset = self::$_wpdb->charset; 484 484 if ( isset( $data[0]['connection_charset'] ) ) { … … 513 513 * @covers wpdb::process_fields 514 514 */ 515 function test_process_fields_failure() {515 public function test_process_fields_failure() { 516 516 global $wpdb; 517 517 … … 529 529 * @ticket 21212 530 530 */ 531 function data_process_field_charsets() {531 public function data_process_field_charsets() { 532 532 if ( $GLOBALS['wpdb']->charset ) { 533 533 $charset = $GLOBALS['wpdb']->charset; … … 600 600 * @covers wpdb::process_field_charsets 601 601 */ 602 function test_process_field_charsets( $data, $expected, $message ) {602 public function test_process_field_charsets( $data, $expected, $message ) { 603 603 $actual = self::$_wpdb->process_field_charsets( $data, $GLOBALS['wpdb']->posts ); 604 604 $this->assertSame( $expected, $actual, $message ); … … 612 612 * @depends test_process_field_charsets 613 613 */ 614 function test_process_field_charsets_on_nonexistent_table() {614 public function test_process_field_charsets_on_nonexistent_table() { 615 615 $data = array( 616 616 'post_content' => array( … … 629 629 * @covers wpdb::check_ascii 630 630 */ 631 function test_check_ascii() {631 public function test_check_ascii() { 632 632 $ascii = "\0\t\n\r '" . '!"#$%&()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~'; 633 633 $this->assertTrue( self::$_wpdb->check_ascii( $ascii ) ); … … 639 639 * @covers wpdb::check_ascii 640 640 */ 641 function test_check_ascii_false() {641 public function test_check_ascii_false() { 642 642 $this->assertFalse( self::$_wpdb->check_ascii( 'ABCDEFGHIJKLMNOPQRSTUVWXYZ¡©«' ) ); 643 643 } … … 648 648 * @covers wpdb::strip_invalid_text_for_column 649 649 */ 650 function test_strip_invalid_text_for_column() {650 public function test_strip_invalid_text_for_column() { 651 651 global $wpdb; 652 652 … … 738 738 * @ticket 21212 739 739 */ 740 function data_test_get_table_charset() {740 public function data_test_get_table_charset() { 741 741 $table_name = 'test_get_table_charset'; 742 742 … … 758 758 * @covers wpdb::get_table_charset 759 759 */ 760 function test_get_table_charset( $drop, $create, $table, $expected_charset ) {760 public function test_get_table_charset( $drop, $create, $table, $expected_charset ) { 761 761 self::$_wpdb->query( $drop ); 762 762 … … 779 779 * @ticket 21212 780 780 */ 781 function data_test_get_column_charset() {781 public function data_test_get_column_charset() { 782 782 $table_name = 'test_get_column_charset'; 783 783 … … 799 799 * @covers wpdb::get_col_charset 800 800 */ 801 function test_get_column_charset( $drop, $create, $table, $expected_charset ) {801 public function test_get_column_charset( $drop, $create, $table, $expected_charset ) { 802 802 self::$_wpdb->query( $drop ); 803 803 … … 822 822 * @covers wpdb::get_col_charset 823 823 */ 824 function test_get_column_charset_non_mysql( $drop, $create, $table, $columns ) {824 public function test_get_column_charset_non_mysql( $drop, $create, $table, $columns ) { 825 825 self::$_wpdb->query( $drop ); 826 826 … … 849 849 * @covers wpdb::get_col_charset 850 850 */ 851 function test_get_column_charset_is_mysql_undefined( $drop, $create, $table, $columns ) {851 public function test_get_column_charset_is_mysql_undefined( $drop, $create, $table, $columns ) { 852 852 self::$_wpdb->query( $drop ); 853 853 … … 873 873 * @ticket 21212 874 874 */ 875 function data_strip_invalid_text_from_query() {875 public function data_strip_invalid_text_from_query() { 876 876 $table_name = 'strip_invalid_text_from_query_table'; 877 877 $data = array( … … 909 909 * @covers wpdb::strip_invalid_text_from_query 910 910 */ 911 function test_strip_invalid_text_from_query( $create, $query, $expected, $drop ) {911 public function test_strip_invalid_text_from_query( $create, $query, $expected, $drop ) { 912 912 self::$_wpdb->query( $drop ); 913 913 … … 927 927 * @ticket 32104 928 928 */ 929 function data_dont_strip_text_from_schema_queries() {929 public function data_dont_strip_text_from_schema_queries() { 930 930 // An obviously invalid and fake table name. 931 931 $table_name = "\xff\xff\xff\xff"; … … 953 953 * @covers wpdb::strip_invalid_text_from_query 954 954 */ 955 function test_dont_strip_text_from_schema_queries( $query ) {955 public function test_dont_strip_text_from_schema_queries( $query ) { 956 956 $return = self::$_wpdb->strip_invalid_text_from_query( $query ); 957 957 $this->assertSame( $query, $return ); … … 963 963 * @covers wpdb::query 964 964 */ 965 function test_invalid_characters_in_query() {965 public function test_invalid_characters_in_query() { 966 966 global $wpdb; 967 967 … … 977 977 * @ticket 21212 978 978 */ 979 function data_table_collation_check() {979 public function data_table_collation_check() { 980 980 $table_name = 'table_collation_check'; 981 981 $data = array( … … 1035 1035 * @covers wpdb::check_safe_collation 1036 1036 */ 1037 function test_table_collation_check( $create, $expected, $query, $drop, $always_true ) {1037 public function test_table_collation_check( $create, $expected, $query, $drop, $always_true ) { 1038 1038 self::$_wpdb->query( $drop ); 1039 1039 … … 1054 1054 * @covers wpdb::strip_invalid_text_for_column 1055 1055 */ 1056 function test_strip_invalid_text_for_column_bails_if_ascii_input_too_long() {1056 public function test_strip_invalid_text_for_column_bails_if_ascii_input_too_long() { 1057 1057 global $wpdb; 1058 1058 … … 1071 1071 * @covers wpdb::strip_invalid_text_from_query 1072 1072 */ 1073 function test_strip_invalid_text_from_query_cp1251_is_safe() {1073 public function test_strip_invalid_text_from_query_cp1251_is_safe() { 1074 1074 $tablename = 'test_cp1251_query_' . rand_str( 5 ); 1075 1075 if ( ! self::$_wpdb->query( "CREATE TABLE $tablename ( a VARCHAR(50) ) DEFAULT CHARSET 'cp1251'" ) ) { … … 1090 1090 * @covers wpdb::strip_invalid_text_from_query 1091 1091 */ 1092 function test_no_db_charset_defined() {1092 public function test_no_db_charset_defined() { 1093 1093 $tablename = 'test_cp1251_query_' . rand_str( 5 ); 1094 1094 if ( ! self::$_wpdb->query( "CREATE TABLE $tablename ( a VARCHAR(50) ) DEFAULT CHARSET 'cp1251'" ) ) { … … 1114 1114 * @covers wpdb::set_charset 1115 1115 */ 1116 function test_set_charset_changes_the_connection_collation() {1116 public function test_set_charset_changes_the_connection_collation() { 1117 1117 self::$_wpdb->set_charset( self::$_wpdb->dbh, 'utf8', 'utf8_general_ci' ); 1118 1118 $results = self::$_wpdb->get_results( "SHOW VARIABLES WHERE Variable_name='collation_connection'" );
Note: See TracChangeset
for help on using the changeset viewer.