mirror of
git://develop.git.wordpress.org/
synced 2025-02-07 08:04:27 +01:00
Tests: Remove unnecessary file copying in WP_Customize_Manager
tests.
This was added to avoid creating leftover image sub-sizes in the version-controlled `DIR_TESTDATA` directory. However, this does not appear to be necessary: * `WP_Customizer_Manager::import_theme_starter_content()` already [source:tags/6.0.2/src/wp-includes/class-wp-customize-manager.php?marks=1370-1374#L1367 makes a copy of the image] before sideloading, so the test was essentially working with a copy of a copy. * The images were only used in one test out of 70 and do not need to be copied for every single test. Upon further investigation, there is also no evidence that creating these copies actually resolved the reported issue: * `WP_UnitTest_Factory_For_Attachment::create_object()` inserts an attachment, but does not create image sub-sizes. * `media_handle_sideload()` does create image sub-sizes, but the file is already in the media library by that time, and sub-sizes are created in the `uploads` directory, not in the version-controlled `DIR_TESTDATA` directory. This commit removes ~140 redundant file copying operations when running the test suite. Follow-up to [39276], [39346], [39411], [40142]. See #55652. git-svn-id: https://develop.svn.wordpress.org/trunk@54424 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
8d25a65892
commit
323ac54d4b
@ -33,20 +33,6 @@ class Tests_WP_Customize_Manager extends WP_UnitTestCase {
|
||||
*/
|
||||
protected static $subscriber_user_id;
|
||||
|
||||
/**
|
||||
* Path to test file 1.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $test_file;
|
||||
|
||||
/**
|
||||
* Path to test file 2.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $test_file2;
|
||||
|
||||
/**
|
||||
* Set up before class.
|
||||
*
|
||||
@ -64,13 +50,6 @@ class Tests_WP_Customize_Manager extends WP_UnitTestCase {
|
||||
parent::set_up();
|
||||
require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
|
||||
$this->manager = $this->instantiate();
|
||||
|
||||
$orig_file = DIR_TESTDATA . '/images/canola.jpg';
|
||||
$this->test_file = get_temp_dir() . 'canola.jpg';
|
||||
copy( $orig_file, $this->test_file );
|
||||
$orig_file2 = DIR_TESTDATA . '/images/waffles.jpg';
|
||||
$this->test_file2 = get_temp_dir() . 'waffles.jpg';
|
||||
copy( $orig_file2, $this->test_file2 );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -557,7 +536,7 @@ class Tests_WP_Customize_Manager extends WP_UnitTestCase {
|
||||
add_theme_support( 'custom-background' );
|
||||
|
||||
$existing_canola_attachment_id = self::factory()->attachment->create_object(
|
||||
$this->test_file,
|
||||
DIR_TESTDATA . '/images/canola.jpg',
|
||||
0,
|
||||
array(
|
||||
'post_mime_type' => 'image/jpeg',
|
||||
@ -631,13 +610,13 @@ class Tests_WP_Customize_Manager extends WP_UnitTestCase {
|
||||
'post_title' => 'Waffles',
|
||||
'post_content' => 'Waffles Attachment Description',
|
||||
'post_excerpt' => 'Waffles Attachment Caption',
|
||||
'file' => $this->test_file2,
|
||||
'file' => DIR_TESTDATA . '/images/waffles.jpg',
|
||||
),
|
||||
'canola' => array(
|
||||
'post_title' => 'Canola',
|
||||
'post_content' => 'Canola Attachment Description',
|
||||
'post_excerpt' => 'Canola Attachment Caption',
|
||||
'file' => $this->test_file,
|
||||
'file' => DIR_TESTDATA . '/images/canola.jpg',
|
||||
),
|
||||
),
|
||||
'options' => array(
|
||||
|
Loading…
x
Reference in New Issue
Block a user