Changeset 48464
- Timestamp:
- 07/14/2020 01:28:17 AM (4 years ago)
- Location:
- trunk/tests/phpunit
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/abstract-testcase.php
r47880 r48464 914 914 $tmp_dir = ''; 915 915 $dirs = array( 'TMP', 'TMPDIR', 'TEMP' ); 916 916 917 foreach ( $dirs as $dir ) { 917 918 if ( isset( $_ENV[ $dir ] ) && ! empty( $_ENV[ $dir ] ) ) { … … 920 921 } 921 922 } 923 922 924 if ( empty( $tmp_dir ) ) { 923 $tmp_dir = '/tmp'; 924 } 925 $tmp_dir = get_temp_dir(); 926 } 927 925 928 $tmp_dir = realpath( $tmp_dir ); 929 926 930 return tempnam( $tmp_dir, 'wpunit' ); 927 931 } -
trunk/tests/phpunit/tests/customize/manager.php
r48438 r48464 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 } -
trunk/tests/phpunit/tests/file.php
r47122 r48464 9 9 parent::setUp(); 10 10 11 $file = tempnam( '/tmp', 'foo' ); 12 $this->dir = dirname( $file ); 13 unlink( $file ); 11 $this->dir = untrailingslashit( get_temp_dir() ); 14 12 15 13 $this->badchars = '"\'[]*&?$'; -
trunk/tests/phpunit/tests/image/functions.php
r48454 r48464 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 ) { … … 426 426 427 427 $orig_file = DIR_TESTDATA . '/images/wordpress-gsoc-flyer.pdf'; 428 $test_file = '/tmp/wordpress-gsoc-flyer.pdf';428 $test_file = get_temp_dir() . 'wordpress-gsoc-flyer.pdf'; 429 429 copy( $orig_file, $test_file ); 430 430 … … 477 477 478 478 unlink( $test_file ); 479 $temp_dir = get_temp_dir(); 479 480 foreach ( $metadata['sizes'] as $size ) { 480 unlink( '/tmp/'. $size['file'] );481 unlink( $temp_dir . $size['file'] ); 481 482 } 482 483 } … … 561 562 562 563 $orig_file = DIR_TESTDATA . '/images/wordpress-gsoc-flyer.pdf'; 563 $test_file = '/tmp/wordpress-gsoc-flyer.pdf';564 $test_file = get_temp_dir() . 'wordpress-gsoc-flyer.pdf'; 564 565 copy( $orig_file, $test_file ); 565 566 … … 597 598 598 599 unlink( $test_file ); 600 $temp_dir = get_temp_dir(); 599 601 foreach ( $metadata['sizes'] as $size ) { 600 unlink( '/tmp/'. $size['file'] );602 unlink( $temp_dir . $size['file'] ); 601 603 } 602 604 } … … 619 621 } 620 622 623 $temp_dir = get_temp_dir(); 624 621 625 // Dummy JPEGs. 622 $jpg1_path = '/tmp/test.jpg'; // Straight.626 $jpg1_path = $temp_dir . 'test.jpg'; // Straight. 623 627 file_put_contents( $jpg1_path, 'asdf' ); 624 $jpg2_path = '/tmp/test-pdf.jpg'; // With PDF marker.628 $jpg2_path = $temp_dir . 'test-pdf.jpg'; // With PDF marker. 625 629 file_put_contents( $jpg2_path, 'fdsa' ); 626 630 627 631 // PDF with same name as JPEG. 628 $pdf_path = '/tmp/test.pdf';632 $pdf_path = $temp_dir . 'test.pdf'; 629 633 copy( DIR_TESTDATA . '/images/wordpress-gsoc-flyer.pdf', $pdf_path ); 630 634 … … 643 647 644 648 $metadata = wp_generate_attachment_metadata( $attachment_id, $pdf_path ); 645 $preview_path = '/tmp/'. $metadata['sizes']['full']['file'];649 $preview_path = $temp_dir . $metadata['sizes']['full']['file']; 646 650 647 651 // PDF preview didn't overwrite PDF. … … 659 663 unlink( $pdf_path ); 660 664 foreach ( $metadata['sizes'] as $size ) { 661 unlink( '/tmp/'. $size['file'] );665 unlink( $temp_dir . $size['file'] ); 662 666 } 663 667 } -
trunk/tests/phpunit/tests/rest-api/rest-attachments-controller.php
r48291 r48464 81 81 82 82 $orig_file = DIR_TESTDATA . '/images/canola.jpg'; 83 $this->test_file = '/tmp/canola.jpg';83 $this->test_file = get_temp_dir() . 'canola.jpg'; 84 84 copy( $orig_file, $this->test_file ); 85 85 $orig_file2 = DIR_TESTDATA . '/images/codeispoetry.png'; 86 $this->test_file2 = '/tmp/codeispoetry.png';86 $this->test_file2 = get_temp_dir() . 'codeispoetry.png'; 87 87 copy( $orig_file2, $this->test_file2 ); 88 88 } -
trunk/tests/phpunit/tests/rest-api/rest-schema-setup.php
r48291 r48464 227 227 228 228 $media_id = $this->factory->attachment->create_object( 229 '/tmp/canola.jpg',229 get_temp_dir() . 'canola.jpg', 230 230 0, 231 231 array( -
trunk/tests/phpunit/tests/upload.php
r47122 r48464 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. -
trunk/tests/phpunit/tests/widgets/media-gallery-widget.php
r46586 r48464 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( -
trunk/tests/phpunit/tests/widgets/media-image-widget.php
r46586 r48464 413 413 $widget = new WP_Widget_Media_Image(); 414 414 415 $test_image = '/tmp/canola.jpg';415 $test_image = get_temp_dir() . 'canola.jpg'; 416 416 copy( DIR_TESTDATA . '/images/canola.jpg', $test_image ); 417 417 $attachment_id = self::factory()->attachment->create_object( -
trunk/tests/phpunit/tests/widgets/media-widget.php
r46586 r48464 139 139 function test_is_attachment_with_mime_type() { 140 140 141 $test_image = '/tmp/canola.jpg';141 $test_image = get_temp_dir() . 'canola.jpg'; 142 142 copy( DIR_TESTDATA . '/images/canola.jpg', $test_image ); 143 143 $attachment_id = self::factory()->attachment->create_object(
Note: See TracChangeset
for help on using the changeset viewer.