Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Upgrade to Requests 2.0: test updates only
  • Loading branch information
jrfnl committed Nov 24, 2022
commit 0c34efeca3e4fa4a044636fc3915c0eabc297416
4 changes: 2 additions & 2 deletions tests/phpunit/tests/feed/wpSimplePieFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function mocked_response_single_header_values() {
);

return array(
'headers' => new Requests_Utility_CaseInsensitiveDictionary( $single_value_headers ),
'headers' => new WpOrg\Requests\Utility\CaseInsensitiveDictionary( $single_value_headers ),
'body' => file_get_contents( DIR_TESTDATA . '/feed/wordpress-org-news.xml' ),
'response' => array(
'code' => 200,
Expand Down Expand Up @@ -114,7 +114,7 @@ public function mocked_response_multiple_header_values() {
),
);

$response['headers'] = new Requests_Utility_CaseInsensitiveDictionary( $multiple_value_headers );
$response['headers'] = new WpOrg\Requests\Utility\CaseInsensitiveDictionary( $multiple_value_headers );

return $response;
}
Expand Down
9 changes: 4 additions & 5 deletions tests/phpunit/tests/functions/maybeSerialize.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,9 @@ public function data_is_not_serialized() {
public function test_deserialize_request_utility_filtered_iterator_objects( $value ) {
$serialized = maybe_serialize( $value );

$className = get_class( $value );
if ( $className === 'Requests_Utility_FilteredIterator' || $className === 'WpOrg\Requests\Utility\FilteredIterator' ) {
if ( get_class( $value ) === 'WpOrg\Requests\Utility\FilteredIterator' ) {
$new_value = unserialize( $serialized );
$property = ( new ReflectionClass( 'Requests_Utility_FilteredIterator' ) )->getProperty( 'callback' );
$property = ( new ReflectionClass( 'WpOrg\Requests\Utility\FilteredIterator' ) )->getProperty( 'callback' );
$property->setAccessible( true );
$callback_value = $property->getValue( $new_value );

Expand All @@ -234,10 +233,10 @@ public function test_deserialize_request_utility_filtered_iterator_objects( $val
public function data_serialize_deserialize_objects() {
return array(
'filtered iterator using md5' => array(
new Requests_Utility_FilteredIterator( array( 1 ), 'md5' ),
new WpOrg\Requests\Utility\FilteredIterator( array( 1 ), 'md5' ),
),
'filtered iterator using sha1' => array(
new Requests_Utility_FilteredIterator( array( 1, 2 ), 'sha1' ),
new WpOrg\Requests\Utility\FilteredIterator( array( 1, 2 ), 'sha1' ),
),
'array iterator' => array(
new ArrayIterator( array( 1, 2, 3 ) ),
Expand Down
4 changes: 2 additions & 2 deletions tests/phpunit/tests/http/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,9 @@ public function test_get_response_cookies_with_name_value_array() {
*/
public function test_get_cookie_host_only() {
// Emulate WP_Http::request() internals.
$requests_response = new Requests_Response();
$requests_response = new WpOrg\Requests\Response();

$requests_response->cookies['test'] = Requests_Cookie::parse( 'test=foo; domain=.wordpress.org' );
$requests_response->cookies['test'] = WpOrg\Requests\Cookie::parse( 'test=foo; domain=.wordpress.org' );

$requests_response->cookies['test']->flags['host-only'] = false; // https://github.com/WordPress/Requests/issues/306

Expand Down
4 changes: 2 additions & 2 deletions tests/phpunit/tests/http/http.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,13 +309,13 @@ public function test_normalize_cookies_scalar_values() {
)
);

$this->assertInstanceOf( 'Requests_Cookie_Jar', $cookie_jar );
$this->assertInstanceOf( 'WpOrg\Requests\Cookie\Jar', $cookie_jar );

foreach ( array_keys( $cookies ) as $cookie ) {
if ( 'foo' === $cookie ) {
$this->assertArrayNotHasKey( $cookie, $cookie_jar );
} else {
$this->assertInstanceOf( 'Requests_Cookie', $cookie_jar[ $cookie ] );
$this->assertInstanceOf( 'WpOrg\Requests\Cookie', $cookie_jar[ $cookie ] );
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/tests/rest-api/rest-widgets-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ public function mocked_rss_response() {
);

return array(
'headers' => new Requests_Utility_CaseInsensitiveDictionary( $single_value_headers ),
'headers' => new WpOrg\Requests\Utility\CaseInsensitiveDictionary( $single_value_headers ),
'body' => file_get_contents( DIR_TESTDATA . '/feed/wordpress-org-news.xml' ),
'response' => array(
'code' => 200,
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/tests/widgets/wpWidgetRss.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public function mocked_rss_response() {
);

return array(
'headers' => new Requests_Utility_CaseInsensitiveDictionary( $single_value_headers ),
'headers' => new WpOrg\Requests\Utility\CaseInsensitiveDictionary( $single_value_headers ),
'body' => file_get_contents( DIR_TESTDATA . '/feed/wordpress-org-news.xml' ),
'response' => array(
'code' => 200,
Expand Down