File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,14 +59,16 @@ function rsscloud_parse_request( $wp ) {
5959 }
6060}
6161
62- function rsscloud_notify_result ( $ success , $ msg ) {
63- $ success = esc_attr ( ent2ncr ( wp_strip_all_tags ( $ success ) ) );
64- $ msg = esc_attr ( ent2ncr ( wp_strip_all_tags ( $ msg ) ) );
65-
66- header ( 'Content-Type: text/xml ' );
67- echo "<?xml version='1.0'?> \n" ;
68- echo "<notifyResult success=' " . esc_attr ( $ success ) . "' msg=' " . esc_attr ( $ msg ) . "' /> \n" ;
69- exit ;
62+ if ( ! function_exists ( 'rsscloud_notify_result ' ) ) {
63+ function rsscloud_notify_result ( $ success , $ msg ) {
64+ $ success = esc_attr ( ent2ncr ( wp_strip_all_tags ( $ success ) ) );
65+ $ msg = esc_attr ( ent2ncr ( wp_strip_all_tags ( $ msg ) ) );
66+
67+ header ( 'Content-Type: text/xml ' );
68+ echo "<?xml version='1.0'?> \n" ;
69+ echo "<notifyResult success=' " . esc_attr ( $ success ) . "' msg=' " . esc_attr ( $ msg ) . "' /> \n" ;
70+ exit ;
71+ }
7072}
7173
7274add_action ( 'rss2_head ' , 'rsscloud_add_rss_cloud_element ' );
Original file line number Diff line number Diff line change 2525// Give access to tests_add_filter() function.
2626require_once "{$ _tests_dir }/includes/functions.php " ;
2727
28+ /**
29+ * Exception used to capture rsscloud_notify_result() calls in tests
30+ * instead of calling exit().
31+ */
32+ class RsscloudNotifyResultException extends Exception {
33+ public $ success ;
34+ public $ msg ;
35+
36+ public function __construct ( $ success , $ msg ) {
37+ $ this ->success = $ success ;
38+ $ this ->msg = $ msg ;
39+ parent ::__construct ( "notify_result: success= $ success msg= $ msg " );
40+ }
41+ }
42+
43+ /**
44+ * Test-friendly override of rsscloud_notify_result() that throws
45+ * instead of calling exit.
46+ */
47+ function rsscloud_notify_result ( $ success , $ msg ) {
48+ throw new RsscloudNotifyResultException ( $ success , $ msg );
49+ }
50+
2851/**
2952 * Manually load the plugin being tested.
3053 */
You can’t perform that action at this time.
0 commit comments