diff --git a/tests/phpunit/tests/load/wpFinalizeScrapingEditedFileErrors.php b/tests/phpunit/tests/load/wpFinalizeScrapingEditedFileErrors.php new file mode 100644 index 0000000000000..64caa502cb936 --- /dev/null +++ b/tests/phpunit/tests/load/wpFinalizeScrapingEditedFileErrors.php @@ -0,0 +1,53 @@ +assertSame( + "\n###### wp_scraping_result_start:custom-key-42 ######\n" . + 'true' . + "\n###### wp_scraping_result_end:custom-key-42 ######\n", + $output + ); + } + + /** + * @ticket 65819 + */ + public function test_ignores_non_fatal_errors() { + error_clear_last(); + + // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged, WordPress.PHP.DevelopmentFunctions.error_log_trigger_error -- Populate error_get_last() without raising a fatal. + @trigger_error( 'Warning only', E_USER_WARNING ); + + $output = get_echo( 'wp_finalize_scraping_edited_file_errors', array( 'warn-key' ) ); + + $this->assertSame( + "\n###### wp_scraping_result_start:warn-key ######\n" . + 'true' . + "\n###### wp_scraping_result_end:warn-key ######\n", + $output + ); + } +}