WordPress.org

Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #26829, comment 3


Ignore:
Timestamp:
01/15/2014 04:07:30 AM (8 years ago)
Author:
Faison
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #26829, comment 3

    initial v1  
    33I see that there's a directory for files required for certain unit tests, but I'm not sure where to put test htaccess files. Also, are the files in the /phpunit/data/ directory only to be used for read operations? If that's the case, I start to lean towards wanting to create a temp file with `tempname()`, but there is a possibility that `tempname()` won't work on some computers.
    44Is there a way we can replace the php filesystem calls with an object that can be mocked? I just found the `WP_Filesystem_Direct` class which has the function `get_contents_array()` which is just an abstraction for `file()`. The calls to `fopen`, `fwrite`, and `fclose` in the `insert_with_markers()` function could be removed by first making changes into a new array, imploding that array, and passing the resulting string into the `put_contents()` function.
    5 So what route do you believe would be the best for WordPress and the Test Suite as a whole?
     5So what route do you believe would be the best for WordPress and the Test Suite as a whole? I'm a fan of refactoring the functions to allow for mocks, but you know much more about this whole project than me and I'm willing to go a different route.