[wp-trac] [WordPress Trac] #44605: unit tests that create tmp files should use sys_get_temp_dir() instead of hardcoding /tmp/

WordPress Trac noreply at wordpress.org
Wed Jul 18 22:11:36 UTC 2018


#44605: unit tests that create tmp files should use sys_get_temp_dir() instead of
hardcoding /tmp/
------------------------------+-----------------------------
 Reporter:  pbiron            |      Owner:  (none)
     Type:  defect (bug)      |     Status:  new
 Priority:  normal            |  Milestone:  Awaiting Review
Component:  Build/Test Tools  |    Version:
 Severity:  normal            |   Keywords:
  Focuses:                    |
------------------------------+-----------------------------
 A few of the existing unit tests contain the equivalent of:

 {{{#!php
 copy( DIR_TESTDATA . '/images/foo.jpg', '/tmp/foo.jpg' );
 }}}

 Folks running the tests on Windows need to create `C:\tmp` for those tests
 to succeed.

 Instead, unit tests should use the equivalent of:

 {{{#!php
 copy( DIR_TESTDATA . '/images/foo.jpg', sys_get_temp_dir() .
 DIRECTORY_SEPARATOR . 'foo.jpg' );
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44605>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list