WordPress.org

Make WordPress Core

Changeset 30286


Ignore:
Timestamp:
11/08/2014 09:07:05 PM (6 years ago)
Author:
jeremyfelt
Message:

Move tests for ms_files_rewriting to separate group, ms-files

When the ms_files_rewriting flag is enabled, ms_upload_constants() is required to properly set upload directory constants. Once this fires, it is impossible to clean up for a non ms_files_rewriting test by turning the option back off.

Excluding these tests by default offer a more consistent environment overall. Any tests written for uploaded files in multisite should ideally have a correspondign test in this area.

This commit also moves existing ms_files_rewriting tests for test_switch_upload_dir().

Fixes #30256

Location:
trunk/tests/phpunit
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/bootstrap.php

    r30277 r30286  
    130130
    131131        $ajax_message = true;
     132        $ms_files_message = true;
    132133        foreach ( $options as $option ) {
    133134            switch ( $option[0] ) {
    134135                case '--exclude-group' :
    135136                    $ajax_message = false;
     137                    $ms_files_message = false;
    136138                    continue 2;
    137139                case '--group' :
     
    143145                    }
    144146                    $ajax_message = ! in_array( 'ajax', $groups );
     147                    $ms_files_message = ! in_array( 'ms-files', $groups );
    145148                    continue 2;
    146149            }
     
    149152            echo "Not running ajax tests... To execute these, use --group ajax." . PHP_EOL;
    150153        }
     154        if ( $ms_files_message ) {
     155            echo "Not running ms_files_rewriting tests... To execute these, use --group ms-files." . PHP_EOL;
     156        }
    151157    }
    152158}
  • trunk/tests/phpunit/multisite.xml

    r29954 r30286  
    2424        <exclude>
    2525            <group>ajax</group>
     26            <group>ms-files</group>
    2627        </exclude>
    2728    </groups>
  • trunk/tests/phpunit/tests/multisite/site.php

    r30175 r30286  
    950950        $this->assertEquals( gmstrftime('/%Y/%m'), $info['subdir'] );
    951951        $this->assertEquals( '', $info['error'] );
    952 
    953         update_site_option( 'ms_files_rewriting', 1 );
    954         ms_upload_constants();
    955 
    956         $user_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
    957         $blog_id2 = $this->factory->blog->create( array( 'user_id' => $user_id ) );
    958         $info = wp_upload_dir();
    959         $this->assertEquals( 'http://' . $site->domain . '/wp-content/uploads/' . gmstrftime('%Y/%m'), $info['url'] );
    960         $this->assertEquals( ABSPATH . 'wp-content/uploads/' . gmstrftime('%Y/%m'), $info['path'] );
    961         $this->assertEquals( gmstrftime('/%Y/%m'), $info['subdir'] );
    962         $this->assertEquals( '', $info['error'] );
    963 
    964         switch_to_blog( $blog_id2 );
    965         $info2 = wp_upload_dir();
    966         $this->assertNotEquals( $info, $info2 );
    967         $this->assertEquals( get_option( 'siteurl' )  . '/wp-content/blogs.dir/' . get_current_blog_id() . '/files/' . gmstrftime('%Y/%m'), $info2['url'] );
    968         $this->assertEquals( ABSPATH . 'wp-content/blogs.dir/' . get_current_blog_id() . '/files/' . gmstrftime('%Y/%m'), $info2['path'] );
    969         $this->assertEquals( gmstrftime('/%Y/%m'), $info2['subdir'] );
    970         $this->assertEquals( '', $info2['error'] );
    971         restore_current_blog();
    972         update_site_option( 'ms_files_rewriting', 0 );
    973952    }
    974953
Note: See TracChangeset for help on using the changeset viewer.