Skip to content

Commit

Permalink
Remove deprecated filter (#4962)
Browse files Browse the repository at this point in the history
  • Loading branch information
rebeccahum authored Oct 23, 2023
1 parent 21f4a7a commit 746f135
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 22 deletions.
6 changes: 0 additions & 6 deletions files/class-curl-streamer.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,13 @@ public function __construct( $file_path ) {
}

public function init() {
add_filter( 'http_api_transports', [ $this, 'enforce_curl_transport' ] );
add_action( 'http_api_curl', [ $this, 'init_upload' ], 10 );
}

public function deinit() {
remove_filter( 'http_api_transports', [ $this, 'enforce_curl_transport' ] );
remove_action( 'http_api_curl', [ $this, 'init_upload' ] );
}

public function enforce_curl_transport() {
return [ 'curl' ];
}

public function init_upload( $curl_handle ) {
// phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fopen -- FP - the file is opened read-only
$file_stream = fopen( $this->file_path, 'r' );
Expand Down
16 changes: 0 additions & 16 deletions tests/files/test-curl-streamer.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,6 @@ public function tearDown(): void {
parent::tearDown();
}

public function test__init() {
global $wp_version;

$version = preg_replace( '/-.*$/', '', $wp_version );
if ( version_compare( $version, '6.4', '>=' ) ) {
$this->setExpectedDeprecated( 'http_api_transports' );
}

$expected_transport = 'WP_Http_Curl';

$wp_http = new \WP_Http();
$actual_transport = $wp_http->_get_first_available_transport( [] );

$this->assertEquals( $expected_transport, $actual_transport );
}

public function test__init_upload() {
$this->markTestSkipped( 'Cannot get `curl` opts, making this hard to test. We can look into using a test webserver in the future.' );
}
Expand Down

0 comments on commit 746f135

Please sign in to comment.