Make WordPress Core

Ticket #21292: 21292-unittests.diff

File 21292-unittests.diff, 1.0 KB (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 fd756a6..7b68a01 100644
    a b class Tests_XMLRPC_wp_uploadFile extends WP_XMLRPC_UnitTestCase { 
    3030        }
    3131
    3232        /**
     33         * @ticket 21292
     34         */
     35        function test_network_limit() {
     36                $this->make_user_by_role( 'editor' );
     37
     38                update_option( 'blog_upload_space', 0.1 );
     39
     40                // create attachment
     41                $filename = ( DIR_TESTDATA . '/images/canola.jpg' );
     42                $contents = file_get_contents( $filename );
     43                $data = array(
     44                        'name' => 'canola.jpg',
     45                        'type' => 'image/jpeg',
     46                        'bits' => $contents
     47                );
     48
     49                $result = $this->myxmlrpcserver->mw_newMediaObject( array( 0, 'editor', 'editor', $data ) );
     50
     51                // Only multisite should have a limit
     52                if ( is_multisite() )
     53                        $this->assertInstanceOf( 'IXR_Error', $result );
     54                else
     55                        $this->assertNotInstanceOf( 'IXR_Error', $result );
     56        }
     57
     58        /**
    3359         * @ticket 11946
    3460         */
    3561        function test_valid_mime() {