Ticket #39975: 39975.2.diff
File 39975.2.diff, 7.5 KB (added by , 7 years ago) |
---|
-
tests/phpunit/tests/customize/manager.php
60 60 $this->undefined = new stdClass(); 61 61 62 62 $orig_file = DIR_TESTDATA . '/images/canola.jpg'; 63 $this->test_file = '/tmp/canola.jpg';63 $this->test_file = get_temp_dir() . 'canola.jpg'; 64 64 copy( $orig_file, $this->test_file ); 65 65 $orig_file2 = DIR_TESTDATA . '/images/waffles.jpg'; 66 $this->test_file2 = '/tmp/waffles.jpg';66 $this->test_file2 = get_temp_dir() . 'waffles.jpg'; 67 67 copy( $orig_file2, $this->test_file2 ); 68 68 } 69 69 -
tests/phpunit/tests/file.php
8 8 function setUp() { 9 9 parent::setUp(); 10 10 11 $file = tempnam( '/tmp', 'foo') ; 12 $this->dir = dirname( $file ); 13 unlink( $file ); 14 11 $this->dir = rtrim( get_temp_dir(), DIRECTORY_SEPARATOR ); 15 12 $this->badchars = '"\'[]*&?$'; 16 13 } 17 14 -
tests/phpunit/tests/image/functions.php
20 20 include_once( DIR_TESTDATA . '/../includes/mock-image-editor.php' ); 21 21 22 22 // Ensure no legacy / failed tests detritus. 23 $folder = '/tmp/wordpress-gsoc-flyer*.{jpg,pdf}';23 $folder = get_temp_dir() . 'wordpress-gsoc-flyer*.{jpg,pdf}'; 24 24 25 25 foreach ( glob( $folder, GLOB_BRACE ) as $file ) { 26 26 unlink( $file ); … … 368 368 } 369 369 370 370 $orig_file = DIR_TESTDATA . '/images/wordpress-gsoc-flyer.pdf'; 371 $test_file = '/tmp/wordpress-gsoc-flyer.pdf';371 $test_file = get_temp_dir() . 'wordpress-gsoc-flyer.pdf'; 372 372 copy( $orig_file, $test_file ); 373 373 374 374 $attachment_id = $this->factory->attachment->create_object( $test_file, 0, array( … … 411 411 412 412 unlink( $test_file ); 413 413 foreach ( $metadata['sizes'] as $size ) { 414 unlink ( '/tmp/' . $size['file'] );414 unlink ( get_temp_dir() . '' . $size['file'] ); 415 415 } 416 416 } 417 417 … … 424 424 } 425 425 426 426 $orig_file = DIR_TESTDATA . '/images/wordpress-gsoc-flyer.pdf'; 427 $test_file = '/tmp/wordpress-gsoc-flyer.pdf';427 $test_file = get_temp_dir() . 'wordpress-gsoc-flyer.pdf'; 428 428 copy( $orig_file, $test_file ); 429 429 430 430 $attachment_id = $this->factory->attachment->create_object( $test_file, 0, array( … … 452 452 453 453 unlink( $test_file ); 454 454 foreach ( $metadata['sizes'] as $size ) { 455 unlink ( '/tmp/' . $size['file'] );455 unlink ( get_temp_dir() . '' . $size['file'] ); 456 456 } 457 457 } 458 458 … … 473 473 } 474 474 475 475 // Dummy JPEGs. 476 $jpg1_path = '/tmp/test.jpg'; // Straight.476 $jpg1_path = get_temp_dir() . 'test.jpg'; // Straight. 477 477 file_put_contents( $jpg1_path, 'asdf' ); 478 $jpg2_path = '/tmp/test-pdf.jpg'; // With PDF marker.478 $jpg2_path = get_temp_dir() . 'test-pdf.jpg'; // With PDF marker. 479 479 file_put_contents( $jpg2_path, 'fdsa' ); 480 480 481 481 // PDF with same name as JPEG. 482 $pdf_path = '/tmp/test.pdf';482 $pdf_path = get_temp_dir() . 'test.pdf'; 483 483 copy( DIR_TESTDATA . '/images/wordpress-gsoc-flyer.pdf', $pdf_path ); 484 484 485 485 $attachment_id = $this->factory->attachment->create_object( $pdf_path, 0, array( … … 487 487 ) ); 488 488 489 489 $metadata = wp_generate_attachment_metadata( $attachment_id, $pdf_path ); 490 $preview_path = '/tmp/' . $metadata['sizes']['full']['file'];490 $preview_path = get_temp_dir() . '' . $metadata['sizes']['full']['file']; 491 491 492 492 // PDF preview didn't overwrite PDF. 493 493 $this->assertNotEquals( $pdf_path, $preview_path ); … … 503 503 unlink( $jpg2_path ); 504 504 unlink( $pdf_path ); 505 505 foreach ( $metadata['sizes'] as $size ) { 506 unlink( '/tmp/' . $size['file'] );506 unlink( get_temp_dir() . '' . $size['file'] ); 507 507 } 508 508 } 509 509 } -
tests/phpunit/tests/rest-api/rest-attachments-controller.php
58 58 $role->add_cap( 'level_0' ); 59 59 60 60 $orig_file = DIR_TESTDATA . '/images/canola.jpg'; 61 $this->test_file = '/tmp/canola.jpg';61 $this->test_file = get_temp_dir() . 'canola.jpg'; 62 62 copy( $orig_file, $this->test_file ); 63 63 $orig_file2 = DIR_TESTDATA . '/images/codeispoetry.png'; 64 $this->test_file2 = '/tmp/codeispoetry.png';64 $this->test_file2 = get_temp_dir() . 'codeispoetry.png'; 65 65 copy( $orig_file2, $this->test_file2 ); 66 66 } 67 67 -
tests/phpunit/tests/rest-api/rest-schema-setup.php
176 176 'description' => 'REST API Client Fixture: Tag', 177 177 ) ); 178 178 179 $media_id = $this->factory->attachment->create_object( '/tmp/canola.jpg', 0, array(179 $media_id = $this->factory->attachment->create_object( get_temp_dir() . 'canola.jpg', 0, array( 180 180 'post_mime_type' => 'image/jpeg', 181 181 'post_excerpt' => 'A sample caption', 182 182 'post_name' => 'restapi-client-fixture-attachment', -
tests/phpunit/tests/upload.php
46 46 * @ticket 5953 47 47 */ 48 48 function test_upload_dir_absolute() { 49 $path = '/tmp/wp-unit-test';49 $path = get_temp_dir() . 'wp-unit-test'; 50 50 51 51 // wp_upload_dir() with an absolute upload path 52 52 update_option( 'upload_path', $path ); -
tests/phpunit/tests/widgets/media-gallery-widget.php
58 58 59 59 $attachments = array(); 60 60 foreach ( array( 'canola.jpg', 'waffles.jpg' ) as $filename ) { 61 $test_image = '/tmp/'. $filename;61 $test_image = get_temp_dir() . $filename; 62 62 copy( DIR_TESTDATA . '/images/canola.jpg', $test_image ); 63 63 $attachment_id = self::factory()->attachment->create_object( array( 64 64 'file' => $test_image, -
tests/phpunit/tests/widgets/media-image-widget.php
311 311 function test_render_media() { 312 312 $widget = new WP_Widget_Media_Image(); 313 313 314 $test_image = '/tmp/canola.jpg';314 $test_image = get_temp_dir() . 'canola.jpg'; 315 315 copy( DIR_TESTDATA . '/images/canola.jpg', $test_image ); 316 316 $attachment_id = self::factory()->attachment->create_object( array( 317 317 'file' => $test_image, -
tests/phpunit/tests/widgets/media-widget.php
129 129 */ 130 130 function test_is_attachment_with_mime_type() { 131 131 132 $test_image = '/tmp/canola.jpg';132 $test_image = get_temp_dir() . 'canola.jpg'; 133 133 copy( DIR_TESTDATA . '/images/canola.jpg', $test_image ); 134 134 $attachment_id = self::factory()->attachment->create_object( array( 135 135 'file' => $test_image,