XML-RPC: add a wp_uploadFile unit test.

Props MikeHansenMe.
See #21292.


git-svn-id: https://develop.svn.wordpress.org/trunk@34577 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2015-09-26 04:57:29 +00:00
parent daa01c703b
commit 97a84eb7a7

View File

@ -28,4 +28,31 @@ class Tests_XMLRPC_wp_uploadFile extends WP_XMLRPC_UnitTestCase {
$this->assertInternalType( 'string', $result['url'] );
$this->assertInternalType( 'string', $result['type'] );
}
/**
* @ticket 21292
*/
function test_network_limit() {
$this->make_user_by_role( 'editor' );
update_option( 'blog_upload_space', 0.1 );
// create attachment
$filename = ( DIR_TESTDATA . '/images/canola.jpg' );
$contents = file_get_contents( $filename );
$data = array(
'name' => 'canola.jpg',
'type' => 'image/jpeg',
'bits' => $contents
);
$result = $this->myxmlrpcserver->mw_newMediaObject( array( 0, 'editor', 'editor', $data ) );
// Only multisite should have a limit
if ( is_multisite() ) {
$this->assertInstanceOf( 'IXR_Error', $result );
} else {
$this->assertNotInstanceOf( 'IXR_Error', $result );
}
}
}