mirror of
git://develop.git.wordpress.org/
synced 2025-03-24 13:59:48 +01:00
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
This commit is contained in:
parent
6f021272d3
commit
17643e8645
tests/phpunit/tests
@ -26,10 +26,10 @@ class Tests_Functions_wpRemoteFopen extends WP_UnitTestCase {
|
||||
*/
|
||||
public function test_wp_remote_fopen() {
|
||||
// This URL gives a direct 200 response.
|
||||
$url = 'https://asdftestblog1.files.wordpress.com/2007/09/2007-06-30-dsc_4700-1.jpg';
|
||||
$url = 'https://asdftestblog1.wordpress.com/wp-content/uploads/2007/09/2007-06-30-dsc_4700-1.jpg';
|
||||
$response = wp_remote_fopen( $url );
|
||||
|
||||
$this->assertIsString( $response );
|
||||
$this->assertSame( 40148, strlen( $response ) );
|
||||
$this->assertSame( 31325, strlen( $response ) );
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ class Tests_HTTP_Functions extends WP_UnitTestCase {
|
||||
*/
|
||||
public function test_head_request() {
|
||||
// This URL gives a direct 200 response.
|
||||
$url = 'https://asdftestblog1.files.wordpress.com/2007/09/2007-06-30-dsc_4700-1.jpg';
|
||||
$url = 'https://asdftestblog1.wordpress.com/wp-content/uploads/2007/09/2007-06-30-dsc_4700-1.jpg';
|
||||
$response = wp_remote_head( $url );
|
||||
|
||||
$this->skipTestOnTimeout( $response );
|
||||
@ -21,7 +21,7 @@ class Tests_HTTP_Functions extends WP_UnitTestCase {
|
||||
$this->assertIsArray( $response );
|
||||
|
||||
$this->assertSame( 'image/jpeg', $headers['Content-Type'] );
|
||||
$this->assertSame( '40148', $headers['Content-Length'] );
|
||||
$this->assertSame( '31325', $headers['Content-Length'] );
|
||||
$this->assertSame( 200, wp_remote_retrieve_response_code( $response ) );
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ class Tests_HTTP_Functions extends WP_UnitTestCase {
|
||||
* @covers ::wp_remote_head
|
||||
*/
|
||||
public function test_head_404() {
|
||||
$url = 'https://asdftestblog1.files.wordpress.com/2007/09/awefasdfawef.jpg';
|
||||
$url = 'https://asdftestblog1.wordpress.com/wp-content/uploads/2007/09/awefasdfawef.jpg';
|
||||
$response = wp_remote_head( $url );
|
||||
|
||||
$this->skipTestOnTimeout( $response );
|
||||
@ -66,7 +66,7 @@ class Tests_HTTP_Functions extends WP_UnitTestCase {
|
||||
|
||||
// Should return the same headers as a HEAD request.
|
||||
$this->assertSame( 'image/jpeg', $headers['Content-Type'] );
|
||||
$this->assertSame( '40148', $headers['Content-Length'] );
|
||||
$this->assertSame( '31325', $headers['Content-Length'] );
|
||||
$this->assertSame( 200, wp_remote_retrieve_response_code( $response ) );
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ class Tests_HTTP_Functions extends WP_UnitTestCase {
|
||||
|
||||
// Should return the same headers as a HEAD request.
|
||||
$this->assertSame( 'image/jpeg', $headers['Content-Type'] );
|
||||
$this->assertSame( '40148', $headers['Content-Length'] );
|
||||
$this->assertSame( '31325', $headers['Content-Length'] );
|
||||
$this->assertSame( 200, wp_remote_retrieve_response_code( $response ) );
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user