Changeset 33479 for branches/4.1/tests/phpunit/tests/db/charset.php
- Timestamp:
- 07/29/2015 06:45:12 AM (11 years ago)
- File:
-
- 1 edited
-
branches/4.1/tests/phpunit/tests/db/charset.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/4.1/tests/phpunit/tests/db/charset.php
r33478 r33479 214 214 'expected' => "\xd8ord\xd0ress", 215 215 'length' => array( 'type' => 'char', 'length' => 100 ), 216 ), 217 'cp1251_no_length' => array( 218 'charset' => 'cp1251', 219 'value' => "\xd8ord\xd0ress", 220 'expected' => "\xd8ord\xd0ress", 221 'length' => false, 222 ), 223 'cp1251_no_length_ascii' => array( 224 'charset' => 'cp1251', 225 'value' => "WordPress", 226 'expected' => "WordPress", 227 'length' => false, 228 // Don't set 'ascii' => true/false. 229 // That's a different codepath than it being unset even if 230 // three's only only ASCII in the value. 216 231 ), 217 232 'cp1251_char_length' => array( … … 804 819 $this->assertEquals( 255, strlen( $stripped ) ); 805 820 } 821 822 /** 823 * @ticket 32279 824 */ 825 function test_strip_invalid_text_from_query_cp1251_is_safe() { 826 $tablename = 'test_cp1251_query_' . rand_str( 5 ); 827 if ( ! self::$_wpdb->query( "CREATE TABLE $tablename ( a VARCHAR(50) ) DEFAULT CHARSET 'cp1251'" ) ) { 828 $this->markTestSkipped( "Test requires the 'cp1251' charset" ); 829 } 830 831 $safe_query = "INSERT INTO $tablename( `a` ) VALUES( 'safe data' )"; 832 $stripped_query = self::$_wpdb->strip_invalid_text_from_query( $safe_query ); 833 834 self::$_wpdb->query( "DROP TABLE $tablename" ); 835 836 $this->assertEquals( $safe_query, $stripped_query ); 837 } 806 838 }
Note: See TracChangeset
for help on using the changeset viewer.