diff --git a/tests/phpunit/data/images/canola-150x150.jpg b/tests/phpunit/data/images/canola-150x150.jpg deleted file mode 100644 index 994e20d20b..0000000000 Binary files a/tests/phpunit/data/images/canola-150x150.jpg and /dev/null differ diff --git a/tests/phpunit/data/images/canola-300x225.jpg b/tests/phpunit/data/images/canola-300x225.jpg deleted file mode 100644 index 207e8ed1c6..0000000000 Binary files a/tests/phpunit/data/images/canola-300x225.jpg and /dev/null differ diff --git a/tests/phpunit/tests/widgets/media-image-widget.php b/tests/phpunit/tests/widgets/media-image-widget.php index ebd41d6b31..7fadbbc7d3 100644 --- a/tests/phpunit/tests/widgets/media-image-widget.php +++ b/tests/phpunit/tests/widgets/media-image-widget.php @@ -310,13 +310,16 @@ class Test_WP_Widget_Media_Image extends WP_UnitTestCase { */ function test_render_media() { $widget = new WP_Widget_Media_Image(); + + $test_image = '/tmp/canola.jpg'; + copy( DIR_TESTDATA . '/images/canola.jpg', $test_image ); $attachment_id = self::factory()->attachment->create_object( array( - 'file' => DIR_TESTDATA . '/images/canola.jpg', + 'file' => $test_image, 'post_parent' => 0, 'post_mime_type' => 'image/jpeg', 'post_title' => 'Canola', ) ); - wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, DIR_TESTDATA . '/images/canola.jpg' ) ); + wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $test_image ) ); // Should be empty when there is no attachment_id. ob_start(); diff --git a/tests/phpunit/tests/widgets/media-widget.php b/tests/phpunit/tests/widgets/media-widget.php index 6483323322..6620101a2f 100644 --- a/tests/phpunit/tests/widgets/media-widget.php +++ b/tests/phpunit/tests/widgets/media-widget.php @@ -128,13 +128,16 @@ class Test_WP_Widget_Media extends WP_UnitTestCase { * @covers WP_Widget_Media::is_attachment_with_mime_type */ function test_is_attachment_with_mime_type() { + + $test_image = '/tmp/canola.jpg'; + copy( DIR_TESTDATA . '/images/canola.jpg', $test_image ); $attachment_id = self::factory()->attachment->create_object( array( - 'file' => DIR_TESTDATA . '/images/canola.jpg', + 'file' => $test_image, 'post_parent' => 0, 'post_mime_type' => 'image/jpeg', 'post_title' => 'Canola', ) ); - wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, DIR_TESTDATA . '/images/canola.jpg' ) ); + wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $test_image ) ); $widget = $this->get_mocked_class_instance(); $this->assertFalse( $widget->is_attachment_with_mime_type( 0, 'image' ) );