Changeset 37236
- Timestamp:
- 04/18/2016 02:00:36 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/multisite/bootstrap.php
r37234 r37236 63 63 /** 64 64 * @ticket 27003 65 */ 66 function test_get_network_by_path() { 67 $this->assertEquals( self::$network_ids['www.wordpress.net/'], 68 get_network_by_path( 'www.wordpress.net', '/notapath/' )->id ); 69 70 $this->assertEquals( self::$network_ids['www.wordpress.net/two/'], 71 get_network_by_path( 'www.wordpress.net', '/two/' )->id ); 72 73 // This should find /one/ despite the www. 74 $this->assertEquals( self::$network_ids['wordpress.org/one/'], 75 get_network_by_path( 'www.wordpress.org', '/one/' )->id ); 76 77 // This should not find /one/ because the domains don't match. 78 $this->assertEquals( self::$network_ids['wordpress.org/'], 79 get_network_by_path( 'site1.wordpress.org', '/one/' )->id ); 80 81 $this->assertEquals( self::$network_ids['wordpress.net/three/'], 82 get_network_by_path( 'wordpress.net', '/three/' )->id ); 83 84 $this->assertEquals( self::$network_ids['wordpress.net/'], 85 get_network_by_path( 'wordpress.net', '/notapath/' )->id ); 86 87 $this->assertEquals( self::$network_ids['wordpress.net/'], 88 get_network_by_path( 'site1.wordpress.net', '/notapath/' )->id ); 89 90 $this->assertEquals( self::$network_ids['wordpress.net/'], 91 get_network_by_path( 'site1.wordpress.net', '/three/' )->id ); 65 * @dataProvider data_get_network_by_path 66 */ 67 function test_get_network_by_path( $expected_key, $request_domain, $request_path, $message ) { 68 $network = get_network_by_path( $request_domain, $request_path ); 69 $this->assertEquals( self::$network_ids[ $expected_key ], $network->id, $message ); 70 } 71 72 public function data_get_network_by_path() { 73 return array( 74 array( 'wordpress.org/', 'wordpress.org', '/', 'A standard domain and path request should work.' ), 75 array( 'wordpress.net/', 'wordpress.net', '/notapath/', 'A missing path on a top level domain should find the correct network.' ), 76 array( 'www.wordpress.net/', 'www.wordpress.net', '/notapath/', 'A missing path should find the correct network.' ), 77 array( 'wordpress.org/one/', 'www.wordpress.org', '/one/', 'Should find the path despite the www.' ), 78 array( 'wordpress.org/', 'site1.wordpress.org', '/one/', 'Should not find path because domains do not match.' ), 79 array( 'wordpress.net/three/', 'wordpress.net', '/three/', 'A network can have a path.' ), 80 array( 'www.wordpress.net/two/', 'www.wordpress.net', '/two/', 'A www network with a path can coexist with a non-www network.' ), 81 array( 'wordpress.net/', 'site1.wordpress.net', '/notapath/', 'An invalid subdomain should find the top level network domain.' ), 82 array( 'wordpress.net/', 'site1.wordpress.net', '/three/', 'An invalid subdomain and path should find the top level network domain.' ), 83 ); 92 84 } 93 85
Note: See TracChangeset
for help on using the changeset viewer.