mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-16 10:34:26 +00:00
Tests: Bring some consistency to mocking HTTP requests in unit tests.
Includes: * Renaming the `$preempt` parameter to `$response` in the `pre_http_request` filter to better match the context used in callbacks (returning the original value if the conditions are not met rather than preempting the request). * Synchronizing parameter names and types in various `pre_http_request` callbacks in unit tests. Follow-up to [34509], [37907], [40628], [40629], [45667], [46175], [48242], [48462], [49904], [51021], [51973], [52146], [52382], [54043], [54968]. See #56793, #56792. git-svn-id: https://develop.svn.wordpress.org/trunk@55029 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -264,37 +264,37 @@ class Tests_HTTPS_Detection extends WP_UnitTestCase {
|
||||
$this->assertNull( wp_is_local_html_output( $html ) );
|
||||
}
|
||||
|
||||
public function record_request_url( $preempt, $parsed_args, $url ) {
|
||||
public function record_request_url( $response, $parsed_args, $url ) {
|
||||
$this->last_request_url = $url;
|
||||
return $preempt;
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function mock_success_with_sslverify( $preempt, $parsed_args ) {
|
||||
public function mock_success_with_sslverify( $response, $parsed_args ) {
|
||||
if ( ! empty( $parsed_args['sslverify'] ) ) {
|
||||
return $this->mock_success();
|
||||
}
|
||||
return $preempt;
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function mock_error_with_sslverify( $preempt, $parsed_args ) {
|
||||
public function mock_error_with_sslverify( $response, $parsed_args ) {
|
||||
if ( ! empty( $parsed_args['sslverify'] ) ) {
|
||||
return $this->mock_error();
|
||||
}
|
||||
return $preempt;
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function mock_success_without_sslverify( $preempt, $parsed_args ) {
|
||||
public function mock_success_without_sslverify( $response, $parsed_args ) {
|
||||
if ( empty( $parsed_args['sslverify'] ) ) {
|
||||
return $this->mock_success();
|
||||
}
|
||||
return $preempt;
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function mock_error_without_sslverify( $preempt, $parsed_args ) {
|
||||
public function mock_error_without_sslverify( $response, $parsed_args ) {
|
||||
if ( empty( $parsed_args['sslverify'] ) ) {
|
||||
return $this->mock_error();
|
||||
}
|
||||
return $preempt;
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function mock_not_found() {
|
||||
|
||||
Reference in New Issue
Block a user