Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#38574 closed defect (bug) (fixed)

Tests: Remove uploads added by REST API media tests

Reported by: jnylen0's profile jnylen0 Owned by: rachelbaker's profile rachelbaker
Milestone: 4.7 Priority: normal
Severity: normal Version: 4.7
Component: Build/Test Tools Keywords: has-patch needs-testing
Focuses: Cc:

Description

Before this change, running the WP_REST_Attachments_Controller tests multiple times in a row fails because these tests do not clean up their uploaded files. I do not see this error when running the full suite and I'm not sure why, but these files should still be cleaned up.

Here is the error that happens on the 2nd run of these tests:

$ phpunit --filter WP_Test_REST_Attachments_Controller
Installing...
Running as single site... To run multisite, use -c tests/phpunit/multisite.xml
Not running ajax tests. To execute these, use --group ajax.
Not running ms-files tests. To execute these, use --group ms-files.
Not running external-http tests. To execute these, use --group external-http.

PHPUnit 4.8.22 by Sebastian Bergmann and contributors.

.....................................F........................

Time: 4.9 seconds, Memory: 172.25Mb

There was 1 failure:

1) WP_Test_REST_Attachments_Controller::test_create_item_default_filename_title
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'codeispoetry'
+'codeispoetry-1'

Attachments (1)

38574.diff (613 bytes) - added by jnylen0 7 years ago.

Download all attachments as: .zip

Change History (4)

@jnylen0
7 years ago

#1 @jnylen0
7 years ago

  • Keywords has-patch added

#2 @johnbillion
7 years ago

  • Keywords needs-testing added
  • Milestone changed from Awaiting Review to 4.7

This happens in other tests too. See #38264.

#3 @rachelbaker
7 years ago

  • Owner set to rachelbaker
  • Resolution set to fixed
  • Status changed from new to closed

In 39041:

REST API: Delete temporary files during teardown of WP_Test_REST_Attachments_Controller.

Props jnylen0.
Fixes #38574.

Note: See TracTickets for help on using tickets.