From 735424428cb251009b5fad9012e4d5102788ee70 Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Thu, 2 Mar 2017 02:25:05 +0000 Subject: [PATCH] Tests: Starter content tests should use copies of images stored in /tmp. This ensures that generated thumbnails are kept out of the version- controlled `DIR_TESTDATA` directory. Props bor0. Fixes #40008. git-svn-id: https://develop.svn.wordpress.org/trunk@40142 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/customize/manager.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/phpunit/tests/customize/manager.php b/tests/phpunit/tests/customize/manager.php index 70fa395183..3927ce345c 100644 --- a/tests/phpunit/tests/customize/manager.php +++ b/tests/phpunit/tests/customize/manager.php @@ -58,6 +58,13 @@ class Tests_WP_Customize_Manager extends WP_UnitTestCase { require_once( ABSPATH . WPINC . '/class-wp-customize-manager.php' ); $this->manager = $this->instantiate(); $this->undefined = new stdClass(); + + $orig_file = DIR_TESTDATA . '/images/canola.jpg'; + $this->test_file = '/tmp/canola.jpg'; + copy( $orig_file, $this->test_file ); + $orig_file2 = DIR_TESTDATA . '/images/waffles.jpg'; + $this->test_file2 = '/tmp/waffles.jpg'; + copy( $orig_file2, $this->test_file2 ); } /** @@ -318,8 +325,7 @@ class Tests_WP_Customize_Manager extends WP_UnitTestCase { add_theme_support( 'custom-header' ); add_theme_support( 'custom-background' ); - $canola_file = DIR_TESTDATA . '/images/canola.jpg'; - $existing_canola_attachment_id = self::factory()->attachment->create_object( $canola_file, 0, array( + $existing_canola_attachment_id = self::factory()->attachment->create_object( $this->test_file, 0, array( 'post_mime_type' => 'image/jpeg', 'post_type' => 'attachment', 'post_name' => 'canola', @@ -383,13 +389,13 @@ class Tests_WP_Customize_Manager extends WP_UnitTestCase { 'post_title' => 'Waffles', 'post_content' => 'Waffles Attachment Description', 'post_excerpt' => 'Waffles Attachment Caption', - 'file' => DIR_TESTDATA . '/images/waffles.jpg', + 'file' => $this->test_file2, ), 'canola' => array( 'post_title' => 'Canola', 'post_content' => 'Canola Attachment Description', 'post_excerpt' => 'Canola Attachment Caption', - 'file' => DIR_TESTDATA . '/images/canola.jpg', + 'file' => $this->test_file, ), ), 'options' => array(