Widgets: Remove image sizes generated during media widget phpunit tests from being version controlled.

Amends [40640].
See #32417.


git-svn-id: https://develop.svn.wordpress.org/trunk@40674 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Weston Ruter 2017-05-15 22:58:03 +00:00
parent 74128e0e3f
commit 556e793ed6
4 changed files with 10 additions and 4 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

View File

@ -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();

View File

@ -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' ) );