Changeset 47329 for branches/3.9/tests/phpunit/tests/media.php
- Timestamp:
- 02/20/2020 05:04:42 PM (5 years ago)
- Location:
- branches/3.9
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.9
-
branches/3.9/tests/phpunit/tests/media.php
r39717 r47329 124 124 125 125 $out = wp_oembed_get( 'http://www.youtube.com/watch?v=oHg5SJYRHA0' ); 126 $this->assertContains( 'http ://www.youtube.com/embed/oHg5SJYRHA0?feature=oembed', $out );126 $this->assertContains( 'https://www.youtube.com/embed/oHg5SJYRHA0?feature=oembed', $out ); 127 127 128 128 $out = wp_oembed_get( 'https://www.youtube.com/watch?v=oHg5SJYRHA0' ); … … 457 457 ); 458 458 459 $post_id = media_handle_upload( 'upload', 0, array(), array( 'action' => 'test_upload_titles', 'test_form' => false ) ); 459 $post_id = media_handle_upload( 460 'upload', 461 0, 462 array(), 463 array( 464 'action' => 'test_upload_titles', 465 'test_form' => false, 466 /* 467 * This test previously failed on WP < 4.0 due to is_uploaded_file() 468 * and move_uploaded_file() usage in wp_handle_upload(). 469 * 470 * Since successful upload is irrelevant for the purpose of this test, 471 * discarding upload errors allows the test to proceed. 472 */ 473 'upload_error_handler' => array( $this, '_discard_upload_errors' ), 474 ) 475 ); 460 476 461 477 unset( $_FILES['upload'] ); … … 467 483 468 484 $this->assertEquals( 'This is a test', $post->post_title ); 485 } 486 487 function _discard_upload_errors( &$file, $message ) { 488 $uploads = wp_upload_dir(); 489 $filename = wp_unique_filename( $uploads['path'], $file['name'] ); 490 491 $new_file = $uploads['path'] . "/$filename"; 492 $url = $uploads['url'] . "/$filename"; 493 494 return array( 'file' => $new_file, 'url' => $url, 'type' => $file['type'] ); 469 495 } 470 496
Note: See TracChangeset
for help on using the changeset viewer.