Ticket #19235: 19235-ut.diff

File 19235-ut.diff, 1.5 KB (added by ryan, 7 months ago)
Line 
1Index: tests/ms.php
2===================================================================
3--- tests/ms.php        (revision 1080)
4+++ tests/ms.php        (working copy)
5@@ -865,6 +865,27 @@
6                $this->assertEquals( ABSPATH . 'wp-content/uploads/' . gmstrftime('%Y/%m'), $info['path'] );
7                $this->assertEquals( gmstrftime('/%Y/%m'), $info['subdir'] );
8                $this->assertEquals( '', $info['error'] );
9+
10+               update_site_option( 'ms_files_rewriting', 1 );
11+               ms_upload_constants();
12+
13+               $user_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
14+               $blog_id2 = $this->factory->blog->create( array( 'user_id' => $user_id ) );
15+               $info = wp_upload_dir();
16+               $this->assertEquals( 'http://' . $site->domain . '/wp-content/uploads/' . gmstrftime('%Y/%m'), $info['url'] );
17+               $this->assertEquals( ABSPATH . 'wp-content/uploads/' . gmstrftime('%Y/%m'), $info['path'] );
18+               $this->assertEquals( gmstrftime('/%Y/%m'), $info['subdir'] );
19+               $this->assertEquals( '', $info['error'] );
20+
21+               switch_to_blog( $blog_id2 );
22+               $info2 = wp_upload_dir();
23+               $this->assertNotEquals( $info, $info2 );
24+               $this->assertEquals( get_option( 'siteurl' )  . '/wp-content/blogs.dir/' . get_current_blog_id() . '/files/' . gmstrftime('%Y/%m'), $info2['url'] );
25+               $this->assertEquals( ABSPATH . 'wp-content/blogs.dir/' . get_current_blog_id() . '/files/' . gmstrftime('%Y/%m'), $info2['path'] );
26+               $this->assertEquals( gmstrftime('/%Y/%m'), $info2['subdir'] );
27+               $this->assertEquals( '', $info2['error'] );
28+               restore_current_blog();
29+               update_site_option( 'ms_files_rewriting', 0 );
30        }
31 }
32