Changeset 33308 for trunk/tests/phpunit/tests/db/charset.php
- Timestamp:
- 07/17/2015 06:33:36 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/db/charset.php
r32826 r33308 244 244 'expected' => str_repeat( "\xcc\xe3", 5 ), 245 245 'length' => array( 'type' => 'byte', 'length' => 10 ), 246 ), 247 'ujis_with_utf8_connection' => array( 248 'charset' => 'ujis', 249 'connection_charset' => 'utf8', 250 'value' => '自動下書き', 251 'expected' => '自動下書き', 252 'length' => array( 'type' => 'byte', 'length' => 100 ), 253 ), 254 'ujis_with_utf8_connection_char_length' => array( 255 'charset' => 'ujis', 256 'connection_charset' => 'utf8', 257 'value' => '自動下書き', 258 'expected' => '自動下書', 259 'length' => array( 'type' => 'char', 'length' => 4 ), 260 ), 261 'ujis_with_utf8_connection_byte_length' => array( 262 'charset' => 'ujis', 263 'connection_charset' => 'utf8', 264 'value' => '自動下書き', 265 'expected' => '自動', 266 'length' => array( 'type' => 'byte', 'length' => 6 ), 246 267 ), 247 268 'false' => array( … … 290 311 $expected = $field; 291 312 $expected['value'] = $expected['expected']; 292 unset( $expected['expected'], $field['expected'] );313 unset( $expected['expected'], $field['expected'], $expected['connection_charset'] ); 293 314 294 315 // We're keeping track of these for our multiple-field test. … … 304 325 } 305 326 306 // Time for our test of multiple fields at once.307 $data_provider[] = array( $multiple, $multiple_expected, 'multiple fields/charsets' );308 309 327 return $data_provider; 310 328 } … … 319 337 } 320 338 339 $charset = self::$_wpdb->charset; 340 if ( isset( $data[0]['connection_charset'] ) ) { 341 $new_charset = $data[0]['connection_charset']; 342 unset( $data[0]['connection_charset'] ); 343 } else { 344 $new_charset = $data[0]['charset']; 345 } 346 347 self::$_wpdb->charset = $new_charset; 348 self::$_wpdb->set_charset( self::$_wpdb->dbh, $new_charset ); 349 321 350 $actual = self::$_wpdb->strip_invalid_text( $data ); 351 352 self::$_wpdb->charset = $charset; 353 self::$_wpdb->set_charset( self::$_wpdb->dbh, $charset ); 354 322 355 $this->assertSame( $expected, $actual, $message ); 323 356 }
Note: See TracChangeset
for help on using the changeset viewer.