- Timestamp:
- 03/02/2021 03:06:34 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/https-detection.php
r50391 r50471 131 131 if ( is_wp_error( $unverified_response ) ) { 132 132 $support_errors->add( 133 $unverified_response->get_error_code(),134 $unverified_response->get_error_message()133 'https_request_failed', 134 __( 'HTTPS request failed.' ) 135 135 ); 136 136 } else { 137 137 $support_errors->add( 138 138 'ssl_verification_failed', 139 $response->get_error_message()139 __( 'SSL verification failed.' ) 140 140 ); 141 141 } -
trunk/tests/phpunit/tests/https-detection.php
r50391 r50471 57 57 /** 58 58 * @ticket 47577 59 * @ticket 52484 59 60 */ 60 61 public function test_wp_update_https_detection_errors() { … … 69 70 70 71 // If initial request fails and request without SSL verification succeeds, 71 // return error with 'ssl_verification_failed' error code.72 // return 'ssl_verification_failed' error. 72 73 add_filter( 'pre_http_request', array( $this, 'mock_error_with_sslverify' ), 10, 2 ); 73 74 add_filter( 'pre_http_request', array( $this, 'mock_success_without_sslverify' ), 10, 2 ); 74 75 wp_update_https_detection_errors(); 75 76 $this->assertSame( 76 array( 'ssl_verification_failed' => array( 'Bad SSL certificate.') ),77 array( 'ssl_verification_failed' => array( __( 'SSL verification failed.' ) ) ), 77 78 get_option( 'https_detection_errors' ) 78 79 ); 79 80 80 81 // If both initial request and request without SSL verification fail, 81 // return actual error from request.82 // return 'https_request_failed' error. 82 83 add_filter( 'pre_http_request', array( $this, 'mock_error_with_sslverify' ), 10, 2 ); 83 84 add_filter( 'pre_http_request', array( $this, 'mock_error_without_sslverify' ), 10, 2 ); 84 85 wp_update_https_detection_errors(); 85 86 $this->assertSame( 86 array( ' bad_ssl_certificate' => array( 'Bad SSL certificate.') ),87 array( 'https_request_failed' => array( __( 'HTTPS request failed.' ) ) ), 87 88 get_option( 'https_detection_errors' ) 88 89 );
Note: See TracChangeset
for help on using the changeset viewer.