mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-17 07:10:27 +00:00
This improves the consistency of test skipping and ensures that: * The `@requires` annotations use the right condition and format, and are on the right level (class vs. function). * Inline conditions with a `markTestSkipped()` call are only used when annotations cannot be used. * All `markTestSkipped()` calls contain a verbose explanation of why the test is being skipped. Props jrf, hellofromTonya. Fixes #53009. git-svn-id: https://develop.svn.wordpress.org/trunk@51415 602fd350-edb4-49c9-b593-d223f7449a82
38 lines
927 B
PHP
38 lines
927 B
PHP
<?php
|
|
|
|
/**
|
|
* @group xmlrpc
|
|
* @requires function imagejpeg
|
|
*/
|
|
class Tests_XMLRPC_wp_uploadFile extends WP_XMLRPC_UnitTestCase {
|
|
|
|
public function tearDown() {
|
|
$this->remove_added_uploads();
|
|
|
|
parent::tearDown();
|
|
}
|
|
|
|
function test_valid_attachment() {
|
|
$this->make_user_by_role( 'editor' );
|
|
|
|
// Create attachment.
|
|
$filename = ( DIR_TESTDATA . '/images/a2-small.jpg' );
|
|
$contents = file_get_contents( $filename );
|
|
$data = array(
|
|
'name' => 'a2-small.jpg',
|
|
'type' => 'image/jpeg',
|
|
'bits' => $contents,
|
|
);
|
|
|
|
$result = $this->myxmlrpcserver->mw_newMediaObject( array( 0, 'editor', 'editor', $data ) );
|
|
$this->assertNotIXRError( $result );
|
|
|
|
// Check data types.
|
|
$this->assertIsString( $result['id'] );
|
|
$this->assertStringMatchesFormat( '%d', $result['id'] );
|
|
$this->assertIsString( $result['file'] );
|
|
$this->assertIsString( $result['url'] );
|
|
$this->assertIsString( $result['type'] );
|
|
}
|
|
}
|