mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@48464 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -913,16 +913,20 @@ abstract class WP_UnitTestCase_Base extends PHPUnit\Framework\TestCase {
|
||||
public function temp_filename() {
|
||||
$tmp_dir = '';
|
||||
$dirs = array( 'TMP', 'TMPDIR', 'TEMP' );
|
||||
|
||||
foreach ( $dirs as $dir ) {
|
||||
if ( isset( $_ENV[ $dir ] ) && ! empty( $_ENV[ $dir ] ) ) {
|
||||
$tmp_dir = $dir;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( empty( $tmp_dir ) ) {
|
||||
$tmp_dir = '/tmp';
|
||||
$tmp_dir = get_temp_dir();
|
||||
}
|
||||
|
||||
$tmp_dir = realpath( $tmp_dir );
|
||||
|
||||
return tempnam( $tmp_dir, 'wpunit' );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user