From 439d6c49f9440f55ee64589925c8040ff686ff25 Mon Sep 17 00:00:00 2001 From: Daryll Doyle Date: Thu, 26 Sep 2024 17:10:33 +0100 Subject: [PATCH] Update tests --- tests/unit/test-safe-svg.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/unit/test-safe-svg.php b/tests/unit/test-safe-svg.php index 061c175b..70700f53 100644 --- a/tests/unit/test-safe-svg.php +++ b/tests/unit/test-safe-svg.php @@ -41,9 +41,8 @@ public function tearDown(): void { * Test constructor. */ public function test_constructor() { - \WP_Mock::expectFilterAdded( 'upload_mimes', array( $this->instance, 'allow_svg' ) ); \WP_Mock::expectFilterAdded( 'wp_handle_upload_prefilter', array( $this->instance, 'check_for_svg' ) ); - \WP_Mock::expectFilterAdded( 'wp_check_filetype_and_ext', array( $this->instance, 'fix_mime_type_svg' ), 75, 4 ); + \WP_Mock::expectFilterAdded( 'wp_handle_sideload_prefilter', array( $this->instance, 'check_for_svg' ) ); \WP_Mock::expectFilterAdded( 'wp_prepare_attachment_for_js', array( $this->instance, 'fix_admin_preview' ), 10, 3 ); \WP_Mock::expectFilterAdded( 'wp_get_attachment_image_src', array( $this->instance, 'one_pixel_fix' ), 10, 4 ); \WP_Mock::expectFilterAdded( 'admin_post_thumbnail_html', array( $this->instance, 'featured_image_fix' ), 10, 3 ); @@ -159,6 +158,10 @@ public function test_check_for_svg() { 'name' => 'svgTestOne.svg', ); + \WP_Mock::expectFilterAdded( 'upload_mimes', array( $this->instance, 'allow_svg' ) ); + \WP_Mock::expectFilterAdded( 'wp_check_filetype_and_ext', array( $this->instance, 'fix_mime_type_svg' ), 75, 4 ); + \WP_Mock::expectFilterAdded( 'pre_move_uploaded_file', array( $this->instance, 'pre_move_uploaded_file' ) ); + $this->instance->check_for_svg( $file ); // @phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents