Make WordPress Core


Ignore:
Timestamp:
07/14/2020 01:28:17 AM (6 years ago)
Author:
SergeyBiryukov
Message:

Tests: Replace hardcoded /tmp/ references with get_temp_dir().

This allows more tests to pass on Windows.

Props danielhuesken, DJPaul, christophherr, joemcgill, netweb, davidbaumwald, SergeyBiryukov.
Fixes #40856, #39975.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/abstract-testcase.php

    r47880 r48464  
    914914                $tmp_dir = '';
    915915                $dirs    = array( 'TMP', 'TMPDIR', 'TEMP' );
     916
    916917                foreach ( $dirs as $dir ) {
    917918                        if ( isset( $_ENV[ $dir ] ) && ! empty( $_ENV[ $dir ] ) ) {
     
    920921                        }
    921922                }
     923
    922924                if ( empty( $tmp_dir ) ) {
    923                         $tmp_dir = '/tmp';
    924                 }
     925                        $tmp_dir = get_temp_dir();
     926                }
     927
    925928                $tmp_dir = realpath( $tmp_dir );
     929
    926930                return tempnam( $tmp_dir, 'wpunit' );
    927931        }
Note: See TracChangeset for help on using the changeset viewer.