Make WordPress Core


Ignore:
Timestamp:
11/08/2014 09:07:05 PM (9 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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.