Make WordPress Core

Changeset 37241


Ignore:
Timestamp:
04/18/2016 03:38:11 AM (9 years ago)
Author:
jeremyfelt
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/multisite/bootstrap.php

    r37239 r37241  
    188188
    189189    /**
     190     * @ticket 27884
     191     */
     192    public function test_multisite_bootstrap_additional_path_segments() {
     193        global $current_blog;
     194
     195        $expected = array(
     196            'network_id' => self::$network_ids['wordpress.org/'],
     197            'site_id'    => self::$site_ids['wordpress.org/foo/bar/'],
     198        );
     199        add_filter( 'site_by_path_segments_count', array( $this, 'filter_path_segments_to_two' ) );
     200        $this->_setup_host_request( 'wordpress.org', '/foo/bar/' );
     201        $actual = array(
     202            'network_id' => $current_blog->site_id,
     203            'site_id' => $current_blog->blog_id,
     204        );
     205        remove_filter( 'site_by_path_segments_count', array( $this, 'filter_path_segments_to_two' ) );
     206        $this->_setup_host_request( WP_TESTS_DOMAIN, '/' );
     207
     208        $this->assertEqualSetsWithIndex( $expected, $actual );
     209    }
     210
     211    public function filter_path_segments_to_two() {
     212        return 2;
     213    }
     214
     215    /**
    190216     * Reset various globals required for a 'clean' multisite boot.
    191217     *
Note: See TracChangeset for help on using the changeset viewer.