#33 closed defect (fixed)
Fix failed tests in WPTestAttachments
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Fix Existing Tests |
| Component: | Test Framework | Keywords: | attachments |
| Cc: |
Description
Uploaded files are not being removed between tests. When new files are uploaded in subsequent tests, their names are incremented by wp_unique_filename(), and this throws off the assertions.
This fix can be implemented in just WPTestAttachments::tearDown() but we should consider putting it in WPTestCase::tearDown() so it's effective for all tests.
Attachments (2)
Change History (9)
Perhaps just scandir() and unlink() will be enough. WP_Filesystem() could potentially trigger FTP stuff, we just want the direct methods.
Also, I think this is too heavy for WPTestCase::tearDown(). We should place it specifically in the WPTestAttachments::tearDown().
Patch attached for a recursive delete that does not rely on WP_Filesystem(). It's been targeted to just the tests that call wp_upload_bits().
Looks good. I think it would make sense to wrap this into $this->_destroy_attachments() or $this->destroy/empty_uploads(), similar to [675].
- Resolution set to fixed
- Status changed from new to closed
(In [678]) Destroy the contents of the uploads folder in TestUploadFunctions?. fixes #33.

Reset uploads in WPTestCase::tearDown