55 *
66 * @group comment
77 * @covers ::wp_should_disable_pings_for_environment
8- * @covers ::wp_disable_outgoing_pings_for_environment
9- * @covers ::wp_disable_trackback_for_environment
10- * @covers ::wp_disable_xmlrpc_pingback_for_environment
8+ * @covers ::wp_maybe_disable_outgoing_pings_for_environment
9+ * @covers ::wp_maybe_disable_trackback_for_environment
10+ * @covers ::wp_maybe_disable_xmlrpc_pingback_for_environment
1111 *
1212 * @ticket 64837
1313 */
@@ -118,7 +118,7 @@ public function test_outgoing_pingbacks_removed_in_non_production() {
118118 add_action ( 'do_all_pings ' , 'do_all_pingbacks ' , 10 , 0 );
119119
120120 // Fire the priority-1 callback.
121- wp_disable_outgoing_pings_for_environment ();
121+ wp_maybe_disable_outgoing_pings_for_environment ();
122122
123123 $ this ->assertFalse ( has_action ( 'do_all_pings ' , 'do_all_pingbacks ' ) );
124124 }
@@ -131,7 +131,7 @@ public function test_outgoing_trackbacks_removed_in_non_production() {
131131
132132 add_action ( 'do_all_pings ' , 'do_all_trackbacks ' , 10 , 0 );
133133
134- wp_disable_outgoing_pings_for_environment ();
134+ wp_maybe_disable_outgoing_pings_for_environment ();
135135
136136 $ this ->assertFalse ( has_action ( 'do_all_pings ' , 'do_all_trackbacks ' ) );
137137 }
@@ -144,7 +144,7 @@ public function test_outgoing_generic_ping_removed_in_non_production() {
144144
145145 add_action ( 'do_all_pings ' , 'generic_ping ' , 10 , 0 );
146146
147- wp_disable_outgoing_pings_for_environment ();
147+ wp_maybe_disable_outgoing_pings_for_environment ();
148148
149149 $ this ->assertFalse ( has_action ( 'do_all_pings ' , 'generic_ping ' ) );
150150 }
@@ -157,9 +157,9 @@ public function test_enclosures_not_removed_in_non_production() {
157157
158158 add_action ( 'do_all_pings ' , 'do_all_enclosures ' , 10 , 0 );
159159
160- wp_disable_outgoing_pings_for_environment ();
160+ wp_maybe_disable_outgoing_pings_for_environment ();
161161
162- $ this ->assertSame ( 10 , has_action ( 'do_all_pings ' , 'do_all_enclosures ' ) );
162+ $ this ->assertTrue ( has_action ( 'do_all_pings ' , 'do_all_enclosures ' , 10 ) );
163163 }
164164
165165 /**
@@ -172,18 +172,18 @@ public function test_outgoing_pings_preserved_in_production() {
172172 add_action ( 'do_all_pings ' , 'do_all_trackbacks ' , 10 , 0 );
173173 add_action ( 'do_all_pings ' , 'generic_ping ' , 10 , 0 );
174174
175- wp_disable_outgoing_pings_for_environment ();
175+ wp_maybe_disable_outgoing_pings_for_environment ();
176176
177- $ this ->assertSame ( 10 , has_action ( 'do_all_pings ' , 'do_all_pingbacks ' ), 'do_all_pingbacks should still be hooked. ' );
178- $ this ->assertSame ( 10 , has_action ( 'do_all_pings ' , 'do_all_trackbacks ' ), 'do_all_trackbacks should still be hooked. ' );
179- $ this ->assertSame ( 10 , has_action ( 'do_all_pings ' , 'generic_ping ' ), 'generic_ping should still be hooked. ' );
177+ $ this ->assertTrue ( has_action ( 'do_all_pings ' , 'do_all_pingbacks ' , 10 ), 'do_all_pingbacks should still be hooked at priority 10 . ' );
178+ $ this ->assertTrue ( has_action ( 'do_all_pings ' , 'do_all_trackbacks ' , 10 ), 'do_all_trackbacks should still be hooked at priority 10 . ' );
179+ $ this ->assertTrue ( has_action ( 'do_all_pings ' , 'generic_ping ' , 10 ), 'generic_ping should still be hooked at priority 10 . ' );
180180 }
181181
182182 /**
183183 * @ticket 64837
184184 */
185185 public function test_trackback_hook_is_registered () {
186- $ this ->assertSame ( 10 , has_action ( 'pre_trackback_post ' , 'wp_disable_trackback_for_environment ' ) );
186+ $ this ->assertTrue ( has_action ( 'pre_trackback_post ' , 'wp_maybe_disable_trackback_for_environment ' , 10 ) );
187187 }
188188
189189 /**
@@ -211,7 +211,7 @@ public function test_xmlrpc_pingback_removed_in_non_production() {
211211 'wp.getUsersBlogs ' => 'this:wp_getUsersBlogs ' ,
212212 );
213213
214- $ filtered = wp_disable_xmlrpc_pingback_for_environment ( $ methods );
214+ $ filtered = wp_maybe_disable_xmlrpc_pingback_for_environment ( $ methods );
215215
216216 $ this ->assertArrayNotHasKey ( 'pingback.ping ' , $ filtered );
217217 }
@@ -227,7 +227,7 @@ public function test_xmlrpc_pingback_preserved_in_production() {
227227 'wp.getUsersBlogs ' => 'this:wp_getUsersBlogs ' ,
228228 );
229229
230- $ filtered = wp_disable_xmlrpc_pingback_for_environment ( $ methods );
230+ $ filtered = wp_maybe_disable_xmlrpc_pingback_for_environment ( $ methods );
231231
232232 $ this ->assertArrayHasKey ( 'pingback.ping ' , $ filtered );
233233 }
@@ -245,7 +245,7 @@ public function test_xmlrpc_other_methods_preserved_in_non_production() {
245245 'wp.getPost ' => 'this:wp_getPost ' ,
246246 );
247247
248- $ filtered = wp_disable_xmlrpc_pingback_for_environment ( $ methods );
248+ $ filtered = wp_maybe_disable_xmlrpc_pingback_for_environment ( $ methods );
249249
250250 $ this ->assertArrayHasKey ( 'pingback.extensions.getPingbacks ' , $ filtered );
251251 $ this ->assertArrayHasKey ( 'wp.getUsersBlogs ' , $ filtered );
0 commit comments