From f4e093d52816d3743c36b9b89638dbb45b712935 Mon Sep 17 00:00:00 2001 From: vedanshujain Date: Fri, 8 May 2020 03:20:32 +0530 Subject: [PATCH] Fix unit test --- unit-tests/Tests/Version3/functions.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/unit-tests/Tests/Version3/functions.php b/unit-tests/Tests/Version3/functions.php index 3f6f96404de..88522c341d7 100644 --- a/unit-tests/Tests/Version3/functions.php +++ b/unit-tests/Tests/Version3/functions.php @@ -82,7 +82,11 @@ class WC_Tests_API_Functions extends WC_Unit_Test_Case { */ public function test_wc_rest_upload_image_from_url_should_return_error_when_invalid_image_is_passed() { // empty file. - $expected_error_message = 'Invalid image: File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini or by post_max_size being defined as smaller than upload_max_filesize in php.ini.'; + if ( version_compare( get_bloginfo( 'version' ), '5.4-alpha', '>=' ) ) { + $expected_error_message = 'Invalid image: File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini file or by post_max_size being defined as smaller than upload_max_filesize in php.ini.'; + } else { + $expected_error_message = 'Invalid image: File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini or by post_max_size being defined as smaller than upload_max_filesize in php.ini.'; + } $result = wc_rest_upload_image_from_url( 'http://somedomain.com/invalid-image-1.png' ); $this->assertWPError( $result );