From d72c2197ed6ca20010408ae6597a737e7b9aa8c1 Mon Sep 17 00:00:00 2001 From: Jeremy Felt Date: Mon, 18 Apr 2016 03:38:11 +0000 Subject: [PATCH] Tests: Add test for multiple site path segments in bootstrap This fixes a `@todo` that has been around since the introduction of these tests in [28910]. See #36566. git-svn-id: https://develop.svn.wordpress.org/trunk@37241 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/multisite/bootstrap.php | 26 +++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/phpunit/tests/multisite/bootstrap.php b/tests/phpunit/tests/multisite/bootstrap.php index 1c7e544f8c..cea02c3b52 100644 --- a/tests/phpunit/tests/multisite/bootstrap.php +++ b/tests/phpunit/tests/multisite/bootstrap.php @@ -186,6 +186,32 @@ class Tests_Multisite_Bootstrap extends WP_UnitTestCase { ); } + /** + * @ticket 27884 + */ + public function test_multisite_bootstrap_additional_path_segments() { + global $current_blog; + + $expected = array( + 'network_id' => self::$network_ids['wordpress.org/'], + 'site_id' => self::$site_ids['wordpress.org/foo/bar/'], + ); + add_filter( 'site_by_path_segments_count', array( $this, 'filter_path_segments_to_two' ) ); + $this->_setup_host_request( 'wordpress.org', '/foo/bar/' ); + $actual = array( + 'network_id' => $current_blog->site_id, + 'site_id' => $current_blog->blog_id, + ); + remove_filter( 'site_by_path_segments_count', array( $this, 'filter_path_segments_to_two' ) ); + $this->_setup_host_request( WP_TESTS_DOMAIN, '/' ); + + $this->assertEqualSetsWithIndex( $expected, $actual ); + } + + public function filter_path_segments_to_two() { + return 2; + } + /** * Reset various globals required for a 'clean' multisite boot. *