mirrored from git://develop.git.wordpress.org/
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HTTP API: Add some basic tests for
wp_remote_fopen()
.
Props pbearne, donmhico. Fixes #48845. git-svn-id: https://develop.svn.wordpress.org/trunk@47142 602fd350-edb4-49c9-b593-d223f7449a82
- Loading branch information
1 parent
8ba94ec
commit ac6409a
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
/** | ||
* @group http | ||
* @group external-http | ||
* @group functions.php | ||
*/ | ||
class Tests_wp_remote_fopen extends WP_UnitTestCase { | ||
|
||
/** | ||
* @ticket 48845 | ||
*/ | ||
public function test_wp_remote_fopen_empty() { | ||
$this->assertFalse( wp_remote_fopen( '' ) ); | ||
} | ||
|
||
/** | ||
* @ticket 48845 | ||
*/ | ||
public function test_wp_remote_fopen_bad_url() { | ||
$this->assertFalse( wp_remote_fopen( 'wp.com' ) ); | ||
} | ||
|
||
/** | ||
* @ticket 48845 | ||
*/ | ||
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'; | ||
$response = wp_remote_fopen( $url ); | ||
|
||
$this->assertInternalType( 'string', $response ); | ||
$this->assertEquals( 40148, strlen( $response ) ); | ||
} | ||
} |