Changeset 52382
- Timestamp:
- 12/15/2021 07:59:32 PM (3 years ago)
- Location:
- trunk/tests/phpunit/tests
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/admin/includesFile.php
r52242 r52382 292 292 */ 293 293 public function test_download_url_no_warning_for_url_without_path() { 294 // Hook a mocked HTTP request response. 295 add_filter( 'pre_http_request', array( $this, 'mock_http_request' ), 10, 3 ); 296 294 297 $result = download_url( 'https://example.com' ); 295 298 … … 307 310 */ 308 311 public function test_download_url_no_warning_for_url_without_path_with_signature_verification() { 312 // Hook a mocked HTTP request response. 313 add_filter( 'pre_http_request', array( $this, 'mock_http_request' ), 10, 3 ); 314 309 315 add_filter( 310 316 'wp_signature_hosts', … … 327 333 $this->assertSame( 'signature_verification_no_signature', $error->get_error_code() ); 328 334 } 335 336 /** 337 * Mock the HTTP request response. 338 * 339 * @param bool $false False. 340 * @param array $arguments Request arguments. 341 * @param string $url Request URL. 342 * @return array|bool 343 */ 344 public function mock_http_request( $false, $arguments, $url ) { 345 if ( 'https://example.com' === $url ) { 346 return array( 347 'response' => array( 348 'code' => 200, 349 ), 350 ); 351 } 352 353 return $false; 354 } 329 355 } -
trunk/tests/phpunit/tests/functions/doEnclose.php
r51627 r52382 26 26 public function set_up() { 27 27 parent::set_up(); 28 add_filter( 'pre_http_request', array( $this, ' fake_http_request' ), 10, 3 );28 add_filter( 'pre_http_request', array( $this, 'mock_http_request' ), 10, 3 ); 29 29 } 30 30 … … 251 251 252 252 /** 253 * Fakethe HTTP request response.253 * Mock the HTTP request response. 254 254 * 255 255 * @since 5.3.0 … … 258 258 * @param array $arguments Request arguments. 259 259 * @param string $url Request URL. 260 *261 260 * @return array Header. 262 261 */ 263 public function fake_http_request( $false, $arguments, $url ) {262 public function mock_http_request( $false, $arguments, $url ) { 264 263 265 264 // Video and audio headers. -
trunk/tests/phpunit/tests/http/wpGetHttpHeaders.php
r51568 r52382 13 13 parent::set_up(); 14 14 15 // Hook a fakeHTTP request response.16 add_filter( 'pre_http_request', array( $this, ' fake_http_request' ), 10, 3 );15 // Hook a mocked HTTP request response. 16 add_filter( 'pre_http_request', array( $this, 'mock_http_request' ), 10, 3 ); 17 17 } 18 18 … … 48 48 * @param array $arguments Request arguments. 49 49 * @param string $url Request URL. 50 *51 50 * @return array|bool 52 51 */ 53 public function fake_http_request( $false, $arguments, $url ) {52 public function mock_http_request( $false, $arguments, $url ) { 54 53 if ( 'http://example.com' === $url ) { 55 54 return array( 'headers' => true );
Note: See TracChangeset
for help on using the changeset viewer.