Skip to content

Commit 17643e8

Browse files
committed
Tests: Update expectations in wp_remote_head() and wp_remote_get() tests.
It appears that something has changed on the WP.com side to compress the requested images on the fly, which interfered with the previous expectations in these tests. This commit uses a direct file URL and updates the expected image size to match the currently returned response. Follow-up to [139/tests], [31258], [47142]. Reviewed by jorbin. Merges [57903] to the 6.4 branch. Props dextorlobo, swissspidy, davidbaumwald, SergeyBiryukov. See #60865. git-svn-id: https://develop.svn.wordpress.org/branches/6.4@57930 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 6f02127 commit 17643e8

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

tests/phpunit/tests/functions/wpRemoteFopen.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ public function test_wp_remote_fopen_bad_url() {
2626
*/
2727
public function test_wp_remote_fopen() {
2828
// This URL gives a direct 200 response.
29-
$url = 'https://asdftestblog1.files.wordpress.com/2007/09/2007-06-30-dsc_4700-1.jpg';
29+
$url = 'https://asdftestblog1.wordpress.com/wp-content/uploads/2007/09/2007-06-30-dsc_4700-1.jpg';
3030
$response = wp_remote_fopen( $url );
3131

3232
$this->assertIsString( $response );
33-
$this->assertSame( 40148, strlen( $response ) );
33+
$this->assertSame( 31325, strlen( $response ) );
3434
}
3535
}

tests/phpunit/tests/http/functions.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class Tests_HTTP_Functions extends WP_UnitTestCase {
1111
*/
1212
public function test_head_request() {
1313
// This URL gives a direct 200 response.
14-
$url = 'https://asdftestblog1.files.wordpress.com/2007/09/2007-06-30-dsc_4700-1.jpg';
14+
$url = 'https://asdftestblog1.wordpress.com/wp-content/uploads/2007/09/2007-06-30-dsc_4700-1.jpg';
1515
$response = wp_remote_head( $url );
1616

1717
$this->skipTestOnTimeout( $response );
@@ -21,7 +21,7 @@ public function test_head_request() {
2121
$this->assertIsArray( $response );
2222

2323
$this->assertSame( 'image/jpeg', $headers['Content-Type'] );
24-
$this->assertSame( '40148', $headers['Content-Length'] );
24+
$this->assertSame( '31325', $headers['Content-Length'] );
2525
$this->assertSame( 200, wp_remote_retrieve_response_code( $response ) );
2626
}
2727

@@ -41,7 +41,7 @@ public function test_head_redirect() {
4141
* @covers ::wp_remote_head
4242
*/
4343
public function test_head_404() {
44-
$url = 'https://asdftestblog1.files.wordpress.com/2007/09/awefasdfawef.jpg';
44+
$url = 'https://asdftestblog1.wordpress.com/wp-content/uploads/2007/09/awefasdfawef.jpg';
4545
$response = wp_remote_head( $url );
4646

4747
$this->skipTestOnTimeout( $response );
@@ -66,7 +66,7 @@ public function test_get_request() {
6666

6767
// Should return the same headers as a HEAD request.
6868
$this->assertSame( 'image/jpeg', $headers['Content-Type'] );
69-
$this->assertSame( '40148', $headers['Content-Length'] );
69+
$this->assertSame( '31325', $headers['Content-Length'] );
7070
$this->assertSame( 200, wp_remote_retrieve_response_code( $response ) );
7171
}
7272

@@ -87,7 +87,7 @@ public function test_get_redirect() {
8787

8888
// Should return the same headers as a HEAD request.
8989
$this->assertSame( 'image/jpeg', $headers['Content-Type'] );
90-
$this->assertSame( '40148', $headers['Content-Length'] );
90+
$this->assertSame( '31325', $headers['Content-Length'] );
9191
$this->assertSame( 200, wp_remote_retrieve_response_code( $response ) );
9292
}
9393

0 commit comments

Comments
 (0)