WordPress.org

Make WordPress Core

Ticket #19235: 19235-ut.diff

File 19235-ut.diff, 1.5 KB (added by ryan, 19 months ago)
  • tests/ms.php

     
    865865                $this->assertEquals( ABSPATH . 'wp-content/uploads/' . gmstrftime('%Y/%m'), $info['path'] ); 
    866866                $this->assertEquals( gmstrftime('/%Y/%m'), $info['subdir'] ); 
    867867                $this->assertEquals( '', $info['error'] ); 
     868 
     869                update_site_option( 'ms_files_rewriting', 1 ); 
     870                ms_upload_constants(); 
     871 
     872                $user_id = $this->factory->user->create( array( 'role' => 'administrator' ) ); 
     873                $blog_id2 = $this->factory->blog->create( array( 'user_id' => $user_id ) ); 
     874                $info = wp_upload_dir(); 
     875                $this->assertEquals( 'http://' . $site->domain . '/wp-content/uploads/' . gmstrftime('%Y/%m'), $info['url'] ); 
     876                $this->assertEquals( ABSPATH . 'wp-content/uploads/' . gmstrftime('%Y/%m'), $info['path'] ); 
     877                $this->assertEquals( gmstrftime('/%Y/%m'), $info['subdir'] ); 
     878                $this->assertEquals( '', $info['error'] ); 
     879 
     880                switch_to_blog( $blog_id2 ); 
     881                $info2 = wp_upload_dir(); 
     882                $this->assertNotEquals( $info, $info2 ); 
     883                $this->assertEquals( get_option( 'siteurl' )  . '/wp-content/blogs.dir/' . get_current_blog_id() . '/files/' . gmstrftime('%Y/%m'), $info2['url'] ); 
     884                $this->assertEquals( ABSPATH . 'wp-content/blogs.dir/' . get_current_blog_id() . '/files/' . gmstrftime('%Y/%m'), $info2['path'] ); 
     885                $this->assertEquals( gmstrftime('/%Y/%m'), $info2['subdir'] ); 
     886                $this->assertEquals( '', $info2['error'] ); 
     887                restore_current_blog(); 
     888                update_site_option( 'ms_files_rewriting', 0 ); 
    868889        } 
    869890} 
    870891