From f5ce81abfdcd6007e9615e2bc244a6bd852c6176 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sat, 15 Oct 2022 01:10:11 +0000 Subject: [PATCH] Tests: Delete leftover image sub-sizes after `WP_Customize_Manager` tests. After running `phpunit --filter test_import_theme_starter_content`, the following files were generated and left in place in the version-controlled `DIR_TESTDATA` directory, resulting in a dirty working copy of the project: {{{ tests/phpunit/data/images/canola-150x150.jpg tests/phpunit/data/images/canola-300x225.jpg }}} In the test, `canola.jpg` is mocked as an **existing attachment**. When the test invokes `WP_Customize_Manager::import_theme_starter_content()`, existing attachments are passed directly to `wp_generate_attachment_metadata()`, which does not make a copy of the file, and `wp_create_image_subsizes()` creates the above referenced files in the original image's location. By contrast, `waffles.jpg`, also used in the test, is **not** set as an existing attachment, and in `import_theme_starter_content()` is passed to `media_handle_sideload()`, which makes a **copy** of the file in the `wp-content/uploads/` directory, and then calls `wp_create_image_subsizes()` against the new file. The resulting sub-sizes are generated in that location, and are cleaned up during `tear_down()`. The test's `tear_down()` uses `remove_added_uploads()`, which only clears items created in `wp-content/uploads/` (i.e. `waffles*.jpg`), but not the files in the `DIR_TESTDATA` directory (`canola-*.jpg`). This commit addresses the issue by creating a copy of the file in uploads. This better matches the intention of the test, as existing attachments will most likely be located in uploads and not in an arbitrary path like the test data directory. Follow-up to [39276], [39346], [39411], [40142], [54424], [54425]. Props ironprogrammer, audrasjb, boniu91, dariak, SergeyBiryukov. Fixes #56807. Built from https://develop.svn.wordpress.org/trunk@54519 git-svn-id: http://core.svn.wordpress.org/trunk@54074 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/version.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wp-includes/version.php b/wp-includes/version.php index 00317eacc5..9a68a408d9 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.1-RC1-54518'; +$wp_version = '6.1-RC1-54519'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.