Make WordPress Core

Ticket #11946: 11946-unittests.diff

File 11946-unittests.diff, 1002 bytes (added by MikeHansenMe, 10 years ago)

see #30284

  • tests/phpunit/tests/xmlrpc/wp/uploadFile.php

    diff --git a/tests/phpunit/tests/xmlrpc/wp/uploadFile.php b/tests/phpunit/tests/xmlrpc/wp/uploadFile.php
    index 94a143f..7b68a01 100644
    a b class Tests_XMLRPC_wp_uploadFile extends WP_XMLRPC_UnitTestCase { 
    5454                else
    5555                        $this->assertNotInstanceOf( 'IXR_Error', $result );
    5656        }
     57
     58        /**
     59         * @ticket 11946
     60         */
     61        function test_valid_mime() {
     62                $this->make_user_by_role( 'editor' );
     63
     64                // create attachment
     65                $filename = ( DIR_TESTDATA . '/images/test-image-mime-jpg.png' );
     66                $contents = file_get_contents( $filename );
     67                $data = array(
     68                        'name' => 'test-image-mime-jpg.png',
     69                        'type' => 'image/png',
     70                        'bits' => $contents
     71                );
     72
     73                $result = $this->myxmlrpcserver->mw_newMediaObject( array( 0, 'editor', 'editor', $data ) );
     74
     75                $this->assertNotInstanceOf( 'IXR_Error', $result );
     76
     77                $this->assertEquals( 'image/jpeg', $result['type'] );
     78        }
    5779}
     80 No newline at end of file