[wp-trac] [WordPress Trac] #39975: Remove direct calls to '/tmp/' in Unit Tests

WordPress Trac noreply at wordpress.org
Thu Nov 30 06:14:44 UTC 2017


#39975: Remove direct calls to '/tmp/' in Unit Tests
------------------------------+------------------------------
 Reporter:  joemcgill         |       Owner:
     Type:  task (blessed)    |      Status:  new
 Priority:  normal            |   Milestone:  Awaiting Review
Component:  Build/Test Tools  |     Version:
 Severity:  normal            |  Resolution:
 Keywords:  has-patch         |     Focuses:
------------------------------+------------------------------

Comment (by christophherr):

 This would greatly improve unit tests on Windows.

 [https://core.trac.wordpress.org/attachment/ticket/39975/39975.2.diff
 39975.2] replaces additional usages of /tmp from three files in
 phpunit/tests/widgets
 39975.1 and 30075.2 remove 157 errors.


 [https://core.trac.wordpress.org/attachment/ticket/39975/39975.3.diff
 39975.3] replaces symlinks from phpunit/tests/link/themeFile.php using
 parts of @danielhuesken 's patch on #40856.
 On Windows 10 with PHP 7.1.11, this removes the following warnings:

 {{{
 Warning: unlink(C:\laragon\www\trunk/src/wp-content\themes\theme-file-
 parent): Permission denied in
 C:\laragon\www\trunk\tests\phpunit\tests\link\themeFile.php on line 13

 Warning: unlink(C:\laragon\www\trunk/src/wp-content\themes\theme-file-
 child): Permission denied in
 C:\laragon\www\trunk\tests\phpunit\tests\link\themeFile.php on line 14
 }}}

 and also avoids additional warnings when the tests are run again (because
 unlink didn't remove the symlink in the previous run) :

 {{{
 Warning: symlink(): Cannot create symlink, error code(183) in
 C:\laragon\www\trunk\tests\phpunit\tests\link\themeFile.php on line 8

 Warning: symlink(): Cannot create symlink, error code(183) in
 C:\laragon\www\trunk\tests\phpunit\tests\link\themeFile.php on line 9
 }}}


 6 failures remain after 39975.3:

 {{{

 1) Tests_WP_Customize_Manager::test_import_theme_starter_content
 Expected reuse of non-auto-draft attachment.
 Failed asserting that an array contains 914.

 C:\laragon\www\trunk\tests\phpunit\tests\customize\manager.php:644

 2) Tests_DB::test_mysqli_flush_sync
 procedure could not be created (missing privileges?)

 C:\laragon\www\trunk\tests\phpunit\tests\db.php:621

 3) Test_Theme_File::test_theme_file_uri_returns_valid_uri with data set #0
 ('parent-only.php', 'theme-file-parent', array('theme-file-parent'))
 Failed asserting that two strings are identical.
 --- Expected
 +++ Actual
 @@ @@
 -''
 +'C:\laragon\www\trunk\tests\phpunit\includes/../data/themedir1/default
 /parent-only.php'

 C:\laragon\www\trunk\tests\phpunit\tests\link\themeFile.php:117

 4) Test_Theme_File::test_theme_file_uri_returns_valid_uri with data set #1
 ('child-only.php', 'theme-file-child', array('theme-file-child'))
 Failed asserting that two strings are identical.
 --- Expected
 +++ Actual
 @@ @@
 -''
 +'C:\laragon\www\trunk\tests\phpunit\includes/../data/themedir1/default
 /child-only.php'

 C:\laragon\www\trunk\tests\phpunit\tests\link\themeFile.php:117

 5) Test_Theme_File::test_theme_file_uri_returns_valid_uri with data set #2
 ('parent-and-child.php', 'theme-file-child', array('theme-file-parent',
 'theme-file-child'))
 Failed asserting that two strings are identical.
 --- Expected
 +++ Actual
 @@ @@
 -''
 +'C:\laragon\www\trunk\tests\phpunit\includes/../data/themedir1/default
 /parent-and-child.php'

 C:\laragon\www\trunk\tests\phpunit\tests\link\themeFile.php:117

 6) Test_Theme_File::test_theme_file_uri_returns_valid_uri with data set #3
 ('neither.php', 'theme-file-parent', array())
 Failed asserting that two strings are identical.
 --- Expected
 +++ Actual
 @@ @@
 -''
 +'C:\laragon\www\trunk\tests\phpunit\includes/../data/themedir1/default/neither.php'

 C:\laragon\www\trunk\tests\phpunit\tests\link\themeFile.php:117
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39975#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list