Changeset 47338 for branches/3.8/tests/phpunit/tests/media.php
- Timestamp:
- 02/21/2020 01:05:39 PM (6 years ago)
- Location:
- branches/3.8
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
tests/phpunit/tests/media.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/3.8
- Property svn:mergeinfo changed
-
branches/3.8/tests/phpunit/tests/media.php
r39718 r47338 367 367 ); 368 368 369 $post_id = media_handle_upload( 'upload', 0, array(), array( 'action' => 'test_upload_titles', 'test_form' => false ) ); 369 $post_id = media_handle_upload( 370 'upload', 371 0, 372 array(), 373 array( 374 'action' => 'test_upload_titles', 375 'test_form' => false, 376 /* 377 * This test previously failed on WP < 4.0 due to is_uploaded_file() 378 * and move_uploaded_file() usage in wp_handle_upload(). 379 * 380 * Since successful upload is irrelevant for the purpose of this test, 381 * discarding upload errors allows the test to proceed. 382 */ 383 'upload_error_handler' => array( $this, '_discard_upload_errors' ), 384 ) 385 ); 370 386 371 387 unset( $_FILES['upload'] ); … … 377 393 378 394 $this->assertEquals( 'This is a test', $post->post_title ); 395 } 396 397 function _discard_upload_errors( &$file, $message ) { 398 $uploads = wp_upload_dir(); 399 $filename = wp_unique_filename( $uploads['path'], $file['name'] ); 400 401 $new_file = $uploads['path'] . "/$filename"; 402 $url = $uploads['url'] . "/$filename"; 403 404 return array( 'file' => $new_file, 'url' => $url, 'type' => $file['type'] ); 379 405 } 380 406
Note: See TracChangeset
for help on using the changeset viewer.