Make WordPress Core

Changeset 58097


Ignore:
Timestamp:
05/04/2024 07:23:31 PM (2 years ago)
Author:
johnbillion
Message:

Bootstrap/Load: Add support for custom ports in multisite site addresses.

This allows a Multisite network to use an address that includes a port name, such as example.com:1234, and adds support for this to the local development environment too. You can now run a Multisite installation on the local development environment, for example at localhost:8889.

This also fixes some bugs with running a single site installation on a port, and updates the testing infrastructure so that the whole test suite runs both with and without a port number.

Props djzone, scribu, nacin, ipstenu, F J Kaiser, jeremyfelt, johnjamesjacoby, spacedmonkey, PerS, Clorith, Blackbam, enrico.sorcinelli, Jules Colle, obliviousharmony, desrosj, johnbillion

Fixes #21077, #52088

Location:
trunk
Files:
34 edited

Legend:

Unmodified
Added
Removed
  • trunk/.env

    r57678 r58097  
    5454LOCAL_DB_VERSION=8.0
    5555
     56# Whether or not to enable multisite.
     57LOCAL_MULTISITE=false
     58
    5659# The debug settings to add to `wp-config.php`.
    5760LOCAL_WP_DEBUG=true
     
    6164LOCAL_WP_ENVIRONMENT_TYPE=local
    6265LOCAL_WP_DEVELOPMENT_MODE=core
     66LOCAL_WP_TESTS_DOMAIN=example.org
    6367
    6468# The URL to use when running e2e tests.
  • trunk/.github/workflows/phpunit-tests-run.yml

    r57918 r58097  
    4141        type: 'string'
    4242        default: 'phpunit.xml.dist'
     43      tests-domain:
     44        description: 'The domain to use for the tests'
     45        required: false
     46        type: 'string'
     47        default: 'example.org'
    4348      report:
    4449        description: 'Whether to report results to WordPress.org Hosting Tests'
     
    5156  LOCAL_DB_VERSION: ${{ inputs.db-version }}
    5257  LOCAL_PHP_MEMCACHED: ${{ inputs.memcached }}
     58  LOCAL_WP_TESTS_DOMAIN: ${{ inputs.tests-domain }}
    5359  PHPUNIT_CONFIG: ${{ inputs.phpunit-config }}
    5460  PUPPETEER_SKIP_DOWNLOAD: ${{ true }}
     
    7581  # - Submit the test results to the WordPress.org host test results.
    7682  phpunit-tests:
    77     name: PHP ${{ inputs.php }} / ${{ 'mariadb' == inputs.db-type && 'MariaDB' || 'MySQL' }} ${{ inputs.db-version }}${{ inputs.multisite && ' multisite' || '' }}${{ inputs.memcached && ' with memcached' || '' }}${{ inputs.report && ' (test reporting enabled)' || '' }}
     83    name: PHP ${{ inputs.php }} / ${{ 'mariadb' == inputs.db-type && 'MariaDB' || 'MySQL' }} ${{ inputs.db-version }}${{ inputs.multisite && ' multisite' || '' }}${{ inputs.memcached && ' with memcached' || '' }}${{ inputs.report && ' (test reporting enabled)' || '' }} ${{ 'example.org' != inputs.tests-domain && inputs.tests-domain || '' }}
    7884    runs-on: ${{ inputs.os }}
    7985    timeout-minutes: 20
  • trunk/.github/workflows/phpunit-tests.yml

    r57985 r58097  
    4949        db-type: [ 'mysql' ]
    5050        db-version: [ '5.7', '8.0', '8.1', '8.2', '8.3' ]
     51        tests-domain: [ 'example.org' ]
    5152        multisite: [ false, true ]
    5253        memcached: [ false ]
     
    5859            db-type: 'mysql'
    5960            db-version: '5.7'
     61            tests-domain: 'example.org'
    6062            multisite: false
    6163            memcached: true
     
    6466            db-type: 'mysql'
    6567            db-version: '5.7'
     68            tests-domain: 'example.org'
    6669            multisite: true
    6770            memcached: true
     71          # Include jobs with a port on the test domain for both single and multisite.
     72          - os: ubuntu-latest
     73            php: '7.4'
     74            db-type: 'mysql'
     75            db-version: '5.7'
     76            tests-domain: 'example.org:8889'
     77            multisite: false
     78            memcached: false
     79          - os: ubuntu-latest
     80            php: '7.4'
     81            db-type: 'mysql'
     82            db-version: '5.7'
     83            tests-domain: 'example.org:8889'
     84            multisite: true
     85            memcached: false
    6886          # Report test results to the Host Test Results.
    6987          - os: ubuntu-latest
     
    7189            db-type: 'mysql'
    7290            db-version: '5.7'
     91            tests-domain: 'example.org'
    7392            multisite: false
    7493            memcached: false
     
    82101      memcached: ${{ matrix.memcached }}
    83102      phpunit-config: ${{ matrix.multisite && 'tests/phpunit/multisite.xml' || 'phpunit.xml.dist' }}
     103      tests-domain: ${{ matrix.tests-domain }}
    84104      report: ${{ matrix.report || false }}
    85105
  • trunk/src/wp-admin/includes/network.php

    r57793 r58097  
    149149        }
    150150
    151         $hostname  = get_clean_basedomain();
    152         $has_ports = strstr( $hostname, ':' );
    153         if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ), true ) ) ) {
    154                 wp_admin_notice(
    155                         '<strong>' . __( 'Error:' ) . '</strong> ' . __( 'You cannot install a network of sites with your server address.' ),
    156                         array(
    157                                 'additional_classes' => array( 'error' ),
    158                         )
    159                 );
    160 
    161                 echo '<p>' . sprintf(
    162                         /* translators: %s: Port number. */
    163                         __( 'You cannot use port numbers such as %s.' ),
    164                         '<code>' . $has_ports . '</code>'
    165                 ) . '</p>';
    166                 echo '<a href="' . esc_url( admin_url() ) . '">' . __( 'Go to Dashboard' ) . '</a>';
    167                 echo '</div>';
    168                 require_once ABSPATH . 'wp-admin/admin-footer.php';
    169                 die();
    170         }
     151        // Strip standard port from hostname.
     152        $hostname = preg_replace( '/(?::80|:443)$/', '', get_clean_basedomain() );
    171153
    172154        echo '<form method="post">';
  • trunk/src/wp-admin/network/site-info.php

    r56409 r58097  
    6767
    6868                $blog_data['scheme'] = $update_parsed_url['scheme'];
     69
     70                // Make sure to not lose the port if it was provided.
    6971                $blog_data['domain'] = $update_parsed_url['host'];
    70                 $blog_data['path']   = $update_parsed_url['path'];
     72                if ( isset( $update_parsed_url['port'] ) ) {
     73                        $blog_data['domain'] .= ':' . $update_parsed_url['port'];
     74                }
     75
     76                $blog_data['path'] = $update_parsed_url['path'];
    7177        }
    7278
     
    8995        $old_home_url    = trailingslashit( esc_url( get_option( 'home' ) ) );
    9096        $old_home_parsed = parse_url( $old_home_url );
    91 
    92         if ( $old_home_parsed['host'] === $existing_details->domain && $old_home_parsed['path'] === $existing_details->path ) {
     97        $old_home_host   = $old_home_parsed['host'] . ( isset( $old_home_parsed['port'] ) ? ':' . $old_home_parsed['port'] : '' );
     98
     99        if ( $old_home_host === $existing_details->domain && $old_home_parsed['path'] === $existing_details->path ) {
    93100                $new_home_url = untrailingslashit( sanitize_url( $blog_data['scheme'] . '://' . $new_details->domain . $new_details->path ) );
    94101                update_option( 'home', $new_home_url );
     
    97104        $old_site_url    = trailingslashit( esc_url( get_option( 'siteurl' ) ) );
    98105        $old_site_parsed = parse_url( $old_site_url );
    99 
    100         if ( $old_site_parsed['host'] === $existing_details->domain && $old_site_parsed['path'] === $existing_details->path ) {
     106        $old_site_host   = $old_site_parsed['host'] . ( isset( $old_site_parsed['port'] ) ? ':' . $old_site_parsed['port'] : '' );
     107
     108        if ( $old_site_host === $existing_details->domain && $old_site_parsed['path'] === $existing_details->path ) {
    101109                $new_site_url = untrailingslashit( sanitize_url( $blog_data['scheme'] . '://' . $new_details->domain . $new_details->path ) );
    102110                update_option( 'siteurl', $new_site_url );
  • trunk/src/wp-includes/embed.php

    r57987 r58097  
    628628                        array(
    629629                                'host' => '',
     630                                'port' => null,
    630631                                'path' => '/',
    631632                        )
     
    633634
    634635                $qv = array(
    635                         'domain'                 => $url_parts['host'],
     636                        'domain'                 => $url_parts['host'] . ( $url_parts['port'] ? ':' . $url_parts['port'] : '' ),
    636637                        'path'                   => '/',
    637638                        'update_site_meta_cache' => false,
  • trunk/src/wp-includes/feed.php

    r58096 r58097  
    661661 */
    662662function get_self_link() {
    663         $host = parse_url( home_url() );
    664         return set_url_scheme( 'http://' . $host['host'] . wp_unslash( $_SERVER['REQUEST_URI'] ) );
     663        $parsed = parse_url( home_url() );
     664
     665        $domain = $parsed['host'];
     666        if ( isset( $parsed['port'] ) ) {
     667                $domain .= ':' . $parsed['port'];
     668        }
     669
     670        return set_url_scheme( 'http://' . $domain . wp_unslash( $_SERVER['REQUEST_URI'] ) );
    665671}
    666672
  • trunk/src/wp-includes/media.php

    r58037 r58097  
    13641364         * (which is to say, when they share the domain name of the current request).
    13651365         */
    1366         if ( is_ssl() && ! str_starts_with( $image_baseurl, 'https' ) && parse_url( $image_baseurl, PHP_URL_HOST ) === $_SERVER['HTTP_HOST'] ) {
    1367                 $image_baseurl = set_url_scheme( $image_baseurl, 'https' );
     1366        if ( is_ssl() && ! str_starts_with( $image_baseurl, 'https' ) ) {
     1367                // Since the `Host:` header might contain a port we should
     1368                // compare it against the image URL using the same port.
     1369                $parsed = parse_url( $image_baseurl );
     1370                $domain = $parsed['host'];
     1371                if ( isset( $parsed['port'] ) ) {
     1372                        $domain .= ':' . $parsed['port'];
     1373                }
     1374                if ( $_SERVER['HTTP_HOST'] === $domain ) {
     1375                        $image_baseurl = set_url_scheme( $image_baseurl, 'https' );
     1376                }
    13681377        }
    13691378
  • trunk/src/wp-includes/ms-site.php

    r56549 r58097  
    525525        // Sanitize domain if passed.
    526526        if ( array_key_exists( 'domain', $data ) ) {
    527                 $data['domain'] = trim( $data['domain'] );
    528                 $data['domain'] = preg_replace( '/\s+/', '', sanitize_user( $data['domain'], true ) );
    529                 if ( is_subdomain_install() ) {
    530                         $data['domain'] = str_replace( '@', '', $data['domain'] );
    531                 }
     527                $data['domain'] = preg_replace( '/[^a-z0-9\-.:]+/i', '', $data['domain'] );
    532528        }
    533529
  • trunk/tests/phpunit/tests/admin/wpCommentsListTable.php

    r56559 r58097  
    205205
    206206                $expected = array(
    207                         'all'       => '<a href="http://example.org/wp-admin/edit-comments.php?comment_status=all" class="current" aria-current="page">All <span class="count">(<span class="all-count">0</span>)</span></a>',
    208                         'mine'      => '<a href="http://example.org/wp-admin/edit-comments.php?comment_status=mine&#038;user_id=0">Mine <span class="count">(<span class="mine-count">0</span>)</span></a>',
    209                         'moderated' => '<a href="http://example.org/wp-admin/edit-comments.php?comment_status=moderated">Pending <span class="count">(<span class="pending-count">0</span>)</span></a>',
    210                         'approved'  => '<a href="http://example.org/wp-admin/edit-comments.php?comment_status=approved">Approved <span class="count">(<span class="approved-count">0</span>)</span></a>',
    211                         'spam'      => '<a href="http://example.org/wp-admin/edit-comments.php?comment_status=spam">Spam <span class="count">(<span class="spam-count">0</span>)</span></a>',
    212                         'trash'     => '<a href="http://example.org/wp-admin/edit-comments.php?comment_status=trash">Trash <span class="count">(<span class="trash-count">0</span>)</span></a>',
     207                        'all'       => '<a href="http://' . WP_TESTS_DOMAIN . '/wp-admin/edit-comments.php?comment_status=all" class="current" aria-current="page">All <span class="count">(<span class="all-count">0</span>)</span></a>',
     208                        'mine'      => '<a href="http://' . WP_TESTS_DOMAIN . '/wp-admin/edit-comments.php?comment_status=mine&#038;user_id=0">Mine <span class="count">(<span class="mine-count">0</span>)</span></a>',
     209                        'moderated' => '<a href="http://' . WP_TESTS_DOMAIN . '/wp-admin/edit-comments.php?comment_status=moderated">Pending <span class="count">(<span class="pending-count">0</span>)</span></a>',
     210                        'approved'  => '<a href="http://' . WP_TESTS_DOMAIN . '/wp-admin/edit-comments.php?comment_status=approved">Approved <span class="count">(<span class="approved-count">0</span>)</span></a>',
     211                        'spam'      => '<a href="http://' . WP_TESTS_DOMAIN . '/wp-admin/edit-comments.php?comment_status=spam">Spam <span class="count">(<span class="spam-count">0</span>)</span></a>',
     212                        'trash'     => '<a href="http://' . WP_TESTS_DOMAIN . '/wp-admin/edit-comments.php?comment_status=trash">Trash <span class="count">(<span class="trash-count">0</span>)</span></a>',
    213213                );
    214214                $this->assertSame( $expected, $this->table->get_views() );
  • trunk/tests/phpunit/tests/admin/wpPostCommentsListTable.php

    r56547 r58097  
    2727
    2828                $expected = array(
    29                         'all'       => '<a href="http://example.org/wp-admin/edit-comments.php?comment_status=all" class="current" aria-current="page">All <span class="count">(<span class="all-count">0</span>)</span></a>',
    30                         'mine'      => '<a href="http://example.org/wp-admin/edit-comments.php?comment_status=mine&#038;user_id=0">Mine <span class="count">(<span class="mine-count">0</span>)</span></a>',
    31                         'moderated' => '<a href="http://example.org/wp-admin/edit-comments.php?comment_status=moderated">Pending <span class="count">(<span class="pending-count">0</span>)</span></a>',
    32                         'approved'  => '<a href="http://example.org/wp-admin/edit-comments.php?comment_status=approved">Approved <span class="count">(<span class="approved-count">0</span>)</span></a>',
    33                         'spam'      => '<a href="http://example.org/wp-admin/edit-comments.php?comment_status=spam">Spam <span class="count">(<span class="spam-count">0</span>)</span></a>',
    34                         'trash'     => '<a href="http://example.org/wp-admin/edit-comments.php?comment_status=trash">Trash <span class="count">(<span class="trash-count">0</span>)</span></a>',
     29                        'all'       => '<a href="http://' . WP_TESTS_DOMAIN . '/wp-admin/edit-comments.php?comment_status=all" class="current" aria-current="page">All <span class="count">(<span class="all-count">0</span>)</span></a>',
     30                        'mine'      => '<a href="http://' . WP_TESTS_DOMAIN . '/wp-admin/edit-comments.php?comment_status=mine&#038;user_id=0">Mine <span class="count">(<span class="mine-count">0</span>)</span></a>',
     31                        'moderated' => '<a href="http://' . WP_TESTS_DOMAIN . '/wp-admin/edit-comments.php?comment_status=moderated">Pending <span class="count">(<span class="pending-count">0</span>)</span></a>',
     32                        'approved'  => '<a href="http://' . WP_TESTS_DOMAIN . '/wp-admin/edit-comments.php?comment_status=approved">Approved <span class="count">(<span class="approved-count">0</span>)</span></a>',
     33                        'spam'      => '<a href="http://' . WP_TESTS_DOMAIN . '/wp-admin/edit-comments.php?comment_status=spam">Spam <span class="count">(<span class="spam-count">0</span>)</span></a>',
     34                        'trash'     => '<a href="http://' . WP_TESTS_DOMAIN . '/wp-admin/edit-comments.php?comment_status=trash">Trash <span class="count">(<span class="trash-count">0</span>)</span></a>',
    3535                );
    3636                $this->assertSame( $expected, $this->table->get_views() );
  • trunk/tests/phpunit/tests/admin/wpPrivacyRequestsTable.php

    r55562 r58097  
    201201        public function test_get_views_should_return_views_by_default() {
    202202                $expected = array(
    203                         'all' => '<a href="http://example.org/wp-admin/export-personal-data.php" class="current" aria-current="page">All <span class="count">(0)</span></a>',
     203                        'all' => '<a href="http://' . WP_TESTS_DOMAIN . '/wp-admin/export-personal-data.php" class="current" aria-current="page">All <span class="count">(0)</span></a>',
    204204                );
    205205
  • trunk/tests/phpunit/tests/date/getPermalink.php

    r56971 r58097  
    3636                );
    3737
    38                 $this->assertSame( 'http://example.org/2018/07/22/21/13/23', get_permalink( $post_id ) );
     38                $this->assertSame( 'http://' . WP_TESTS_DOMAIN . '/2018/07/22/21/13/23', get_permalink( $post_id ) );
    3939
    4040                // phpcs:ignore WordPress.DateTime.RestrictedFunctions.timezone_change_date_default_timezone_set
    4141                date_default_timezone_set( $timezone );
    42                 $this->assertSame( 'http://example.org/2018/07/22/21/13/23', get_permalink( $post_id ) );
     42                $this->assertSame( 'http://' . WP_TESTS_DOMAIN . '/2018/07/22/21/13/23', get_permalink( $post_id ) );
    4343        }
    4444}
  • trunk/tests/phpunit/tests/dependencies/scripts.php

    r57981 r58097  
    496496         */
    497497        public function data_provider_to_test_various_strategy_dependency_chains() {
     498                $wp_tests_domain = WP_TESTS_DOMAIN;
     499
    498500                return array(
    499501                        'async-dependent-with-one-blocking-dependency' => array(
     
    882884                                },
    883885                                'expected_markup' => <<<HTML
    884 <script type='text/javascript' src='http://example.org/wp-includes/js/jquery/jquery.js' id='jquery-core-js' defer data-wp-strategy='defer'></script>
    885 <script type='text/javascript' src='http://example.org/wp-includes/js/jquery/jquery-migrate.js' id='jquery-migrate-js' defer data-wp-strategy='defer'></script>
     886<script type='text/javascript' src='http://$wp_tests_domain/wp-includes/js/jquery/jquery.js' id='jquery-core-js' defer data-wp-strategy='defer'></script>
     887<script type='text/javascript' src='http://$wp_tests_domain/wp-includes/js/jquery/jquery-migrate.js' id='jquery-migrate-js' defer data-wp-strategy='defer'></script>
    886888<script type='text/javascript' src='https://example.com/theme-functions.js' id='theme-functions-js' defer data-wp-strategy='defer'></script>
    887889HTML
  • trunk/tests/phpunit/tests/functions/referer.php

    r56971 r58097  
    3232
    3333        public function filter_allowed_redirect_hosts( $hosts ) {
    34                 $hosts[] = 'another.' . WP_TESTS_DOMAIN;
     34                // Make sure we're only using the hostname and not anything else that might be in the WP_TESTS_DOMAIN.
     35                $parsed  = parse_url( 'http://' . WP_TESTS_DOMAIN );
     36                $hosts[] = 'another.' . $parsed['host'];
    3537
    3638                return $hosts;
  • trunk/tests/phpunit/tests/functions/wpNonceAys.php

    r56971 r58097  
    2828        public function test_wp_nonce_ays_log_out() {
    2929                $this->expectException( 'WPDieException' );
    30                 $this->expectExceptionMessageMatches( '#You are attempting to log out of Test Blog</p><p>Do you really want to <a href="http://example\.org/wp-login\.php\?action=logout&amp;_wpnonce=.{10}">log out</a>\?#m' );
     30                $this->expectExceptionMessageMatches( '#You are attempting to log out of Test Blog</p><p>Do you really want to <a href="http://' . WP_TESTS_DOMAIN . '/wp-login\.php\?action=logout&amp;_wpnonce=.{10}">log out</a>\?#m' );
    3131                $this->expectExceptionCode( 403 );
    3232
  • trunk/tests/phpunit/tests/general/feedLinksExtra.php

    r56559 r58097  
    441441                $expected  = '<link rel="alternate" type="application/rss+xml"';
    442442                $expected .= ' title="Test Blog &raquo; Post with no comments Comments Feed"';
    443                 $expected .= ' href="http://example.org/?feed=rss2&#038;p=' . self::$post_no_comment_id . '" />' . "\n";
     443                $expected .= ' href="http://' . WP_TESTS_DOMAIN . '/?feed=rss2&#038;p=' . self::$post_no_comment_id . '" />' . "\n";
    444444                $this->assertSame( $expected, get_echo( 'feed_links_extra' ) );
    445445        }
     
    456456                $expected  = '<link rel="alternate" type="application/rss+xml"';
    457457                $expected .= ' title="Test Blog &raquo; Post with no comments Comments Feed"';
    458                 $expected .= ' href="http://example.org/?feed=rss2&#038;p=' . self::$post_no_comment_id . '" />' . "\n";
     458                $expected .= ' href="http://' . WP_TESTS_DOMAIN . '/?feed=rss2&#038;p=' . self::$post_no_comment_id . '" />' . "\n";
    459459                $this->assertSame( $expected, get_echo( 'feed_links_extra' ) );
    460460        }
     
    471471                $expected  = '<link rel="alternate" type="application/rss+xml"';
    472472                $expected .= ' title="Test Blog &raquo; Post with a comment Comments Feed"';
    473                 $expected .= ' href="http://example.org/?feed=rss2&#038;p=' . self::$post_with_comment_id . '" />' . "\n";
     473                $expected .= ' href="http://' . WP_TESTS_DOMAIN . '/?feed=rss2&#038;p=' . self::$post_with_comment_id . '" />' . "\n";
    474474                $this->assertSame( $expected, get_echo( 'feed_links_extra' ) );
    475475        }
     
    508508                $expected  = '<link rel="alternate" type="testing/foo"';
    509509                $expected .= ' title="Test Blog &raquo; Post with a comment Comments Feed"';
    510                 $expected .= ' href="http://example.org/?feed=foo&#038;p=' . self::$post_with_comment_id . '" />' . "\n";
     510                $expected .= ' href="http://' . WP_TESTS_DOMAIN . '/?feed=foo&#038;p=' . self::$post_with_comment_id . '" />' . "\n";
    511511                $this->assertSame( $expected, get_echo( 'feed_links_extra' ) );
    512512        }
  • trunk/tests/phpunit/tests/kses.php

    r57987 r58097  
    17331733                return array(
    17341734                        'valid value for type'                    => array(
    1735                                 '<object type="application/pdf" data="https://example.org/foo.pdf" />',
    1736                                 '<object type="application/pdf" data="https://example.org/foo.pdf" />',
     1735                                '<object type="application/pdf" data="https://' . WP_TESTS_DOMAIN . '/foo.pdf" />',
     1736                                '<object type="application/pdf" data="https://' . WP_TESTS_DOMAIN . '/foo.pdf" />',
    17371737                        ),
    17381738                        'invalid value for type'                  => array(
    1739                                 '<object type="application/exe" data="https://example.org/foo.exe" />',
     1739                                '<object type="application/exe" data="https://' . WP_TESTS_DOMAIN . '/foo.exe" />',
    17401740                                '',
    17411741                        ),
    17421742                        'multiple type attributes, last invalid'  => array(
    1743                                 '<object type="application/pdf" type="application/exe" data="https://example.org/foo.pdf" />',
    1744                                 '<object type="application/pdf" data="https://example.org/foo.pdf" />',
     1743                                '<object type="application/pdf" type="application/exe" data="https://' . WP_TESTS_DOMAIN . '/foo.pdf" />',
     1744                                '<object type="application/pdf" data="https://' . WP_TESTS_DOMAIN . '/foo.pdf" />',
    17451745                        ),
    17461746                        'multiple type attributes, first uppercase, last invalid' => array(
    1747                                 '<object TYPE="application/pdf" type="application/exe" data="https://example.org/foo.pdf" />',
    1748                                 '<object TYPE="application/pdf" data="https://example.org/foo.pdf" />',
     1747                                '<object TYPE="application/pdf" type="application/exe" data="https://' . WP_TESTS_DOMAIN . '/foo.pdf" />',
     1748                                '<object TYPE="application/pdf" data="https://' . WP_TESTS_DOMAIN . '/foo.pdf" />',
    17491749                        ),
    17501750                        'multiple type attributes, last upper case and invalid' => array(
    1751                                 '<object type="application/pdf" TYPE="application/exe" data="https://example.org/foo.pdf" />',
    1752                                 '<object type="application/pdf" data="https://example.org/foo.pdf" />',
     1751                                '<object type="application/pdf" TYPE="application/exe" data="https://' . WP_TESTS_DOMAIN . '/foo.pdf" />',
     1752                                '<object type="application/pdf" data="https://' . WP_TESTS_DOMAIN . '/foo.pdf" />',
    17531753                        ),
    17541754                        'multiple type attributes, first invalid' => array(
    1755                                 '<object type="application/exe" type="application/pdf" data="https://example.org/foo.pdf" />',
     1755                                '<object type="application/exe" type="application/pdf" data="https://' . WP_TESTS_DOMAIN . '/foo.pdf" />',
    17561756                                '',
    17571757                        ),
    17581758                        'multiple type attributes, first upper case and invalid' => array(
    1759                                 '<object TYPE="application/exe" type="application/pdf" data="https://example.org/foo.pdf" />',
     1759                                '<object TYPE="application/exe" type="application/pdf" data="https://' . WP_TESTS_DOMAIN . '/foo.pdf" />',
    17601760                                '',
    17611761                        ),
    17621762                        'multiple type attributes, first invalid, last uppercase' => array(
    1763                                 '<object type="application/exe" TYPE="application/pdf" data="https://example.org/foo.pdf" />',
     1763                                '<object type="application/exe" TYPE="application/pdf" data="https://' . WP_TESTS_DOMAIN . '/foo.pdf" />',
    17641764                                '',
    17651765                        ),
    17661766                        'multiple object tags, last invalid'      => array(
    1767                                 '<object type="application/pdf" data="https://example.org/foo.pdf" /><object type="application/exe" data="https://example.org/foo.exe" />',
    1768                                 '<object type="application/pdf" data="https://example.org/foo.pdf" />',
     1767                                '<object type="application/pdf" data="https://' . WP_TESTS_DOMAIN . '/foo.pdf" /><object type="application/exe" data="https://' . WP_TESTS_DOMAIN . '/foo.exe" />',
     1768                                '<object type="application/pdf" data="https://' . WP_TESTS_DOMAIN . '/foo.pdf" />',
    17691769                        ),
    17701770                        'multiple object tags, first invalid'     => array(
    1771                                 '<object type="application/exe" data="https://example.org/foo.exe" /><object type="application/pdf" data="https://example.org/foo.pdf" />',
    1772                                 '<object type="application/pdf" data="https://example.org/foo.pdf" />',
     1771                                '<object type="application/exe" data="https://' . WP_TESTS_DOMAIN . '/foo.exe" /><object type="application/pdf" data="https://' . WP_TESTS_DOMAIN . '/foo.pdf" />',
     1772                                '<object type="application/pdf" data="https://' . WP_TESTS_DOMAIN . '/foo.pdf" />',
    17731773                        ),
    17741774                        'type attribute with partially incorrect value' => array(
    1775                                 '<object type="application/pdfa" data="https://example.org/foo.pdf" />',
     1775                                '<object type="application/pdfa" data="https://' . WP_TESTS_DOMAIN . '/foo.pdf" />',
    17761776                                '',
    17771777                        ),
    17781778                        'type attribute with empty value'         => array(
    1779                                 '<object type="" data="https://example.org/foo.pdf" />',
     1779                                '<object type="" data="https://' . WP_TESTS_DOMAIN . '/foo.pdf" />',
    17801780                                '',
    17811781                        ),
    17821782                        'type attribute with no value'            => array(
    1783                                 '<object type data="https://example.org/foo.pdf" />',
     1783                                '<object type data="https://' . WP_TESTS_DOMAIN . '/foo.pdf" />',
    17841784                                '',
    17851785                        ),
    17861786                        'no type attribute'                       => array(
    1787                                 '<object data="https://example.org/foo.pdf" />',
     1787                                '<object data="https://' . WP_TESTS_DOMAIN . '/foo.pdf" />',
    17881788                                '',
    17891789                        ),
    17901790                        'different protocol in url'               => array(
    1791                                 '<object type="application/pdf" data="http://example.org/foo.pdf" />',
    1792                                 '<object type="application/pdf" data="http://example.org/foo.pdf" />',
     1791                                '<object type="application/pdf" data="http://' . WP_TESTS_DOMAIN . '/foo.pdf" />',
     1792                                '<object type="application/pdf" data="http://' . WP_TESTS_DOMAIN . '/foo.pdf" />',
    17931793                        ),
    17941794                        'query string on url'                     => array(
    1795                                 '<object type="application/pdf" data="https://example.org/foo.pdf?lol=.pdf" />',
     1795                                '<object type="application/pdf" data="https://' . WP_TESTS_DOMAIN . '/foo.pdf?lol=.pdf" />',
    17961796                                '',
    17971797                        ),
    17981798                        'fragment on url'                         => array(
    1799                                 '<object type="application/pdf" data="https://example.org/foo.pdf#lol.pdf" />',
     1799                                '<object type="application/pdf" data="https://' . WP_TESTS_DOMAIN . '/foo.pdf#lol.pdf" />',
    18001800                                '',
    18011801                        ),
    18021802                        'wrong extension'                         => array(
    1803                                 '<object type="application/pdf" data="https://example.org/foo.php" />',
     1803                                '<object type="application/pdf" data="https://' . WP_TESTS_DOMAIN . '/foo.php" />',
    18041804                                '',
    18051805                        ),
    18061806                        'protocol-relative url'                   => array(
    1807                                 '<object type="application/pdf" data="//example.org/foo.pdf" />',
     1807                                '<object type="application/pdf" data="//' . WP_TESTS_DOMAIN . '/foo.pdf" />',
    18081808                                '',
    18091809                        ),
    18101810                        'unsupported protocol'                    => array(
    1811                                 '<object type="application/pdf" data="ftp://example.org/foo.pdf" />',
     1811                                '<object type="application/pdf" data="ftp://' . WP_TESTS_DOMAIN . '/foo.pdf" />',
    18121812                                '',
    18131813                        ),
     
    18171817                        ),
    18181818                        'url with port number-like path'          => array(
    1819                                 '<object type="application/pdf" data="https://example.org/cat:8888/foo.pdf" />',
    1820                                 '<object type="application/pdf" data="https://example.org/cat:8888/foo.pdf" />',
     1819                                '<object type="application/pdf" data="https://' . WP_TESTS_DOMAIN . '/cat:8888/foo.pdf" />',
     1820                                '<object type="application/pdf" data="https://' . WP_TESTS_DOMAIN . '/cat:8888/foo.pdf" />',
    18211821                        ),
    18221822                );
     
    18691869         */
    18701870        public function wp_kses_upload_dir_filter( $param ) {
    1871                 $url_with_port_number = is_string( $param['url'] ) ? str_replace( 'example.org', 'example.org:8888', $param['url'] ) : $param['url'];
     1871                // Take care to replace the entire domain, including cases where it already has a port number.
     1872                $parsed         = parse_url( $param['url'] );
     1873                $replace_domain = $parsed['host'];
     1874                if ( isset( $parsed['port'] ) ) {
     1875                        $replace_domain .= ':' . $parsed['port'];
     1876                }
     1877
     1878                $url_with_port_number = is_string( $param['url'] ) ? str_replace( $replace_domain, 'example.org:8888', $param['url'] ) : $param['url'];
    18721879                $param['url']         = $url_with_port_number;
    18731880                return $param;
  • trunk/tests/phpunit/tests/media/getAdjacentImageLink.php

    r53480 r58097  
    3333                                'current_attachment_index'  => 3,
    3434                                'expected_attachment_index' => 2,
    35                                 'expected'                  => '<a href=\'http://example.org/?attachment_id=%%ID%%\'><img width="1" height="1" src="' . WP_CONTENT_URL . '/uploads/image2.jpg" class="attachment-thumbnail size-thumbnail" alt="" decoding="async" loading="lazy" /></a>',
     35                                'expected'                  => '<a href=\'http://' . WP_TESTS_DOMAIN . '/?attachment_id=%%ID%%\'><img width="1" height="1" src="' . WP_CONTENT_URL . '/uploads/image2.jpg" class="attachment-thumbnail size-thumbnail" alt="" decoding="async" loading="lazy" /></a>',
    3636                        ),
    3737                        'with text when has previous link' => array(
    3838                                'current_attachment_index'  => 3,
    3939                                'expected_attachment_index' => 2,
    40                                 'expected'                  => '<a href=\'http://example.org/?attachment_id=%%ID%%\'>Some text</a>',
     40                                'expected'                  => '<a href=\'http://' . WP_TESTS_DOMAIN . '/?attachment_id=%%ID%%\'>Some text</a>',
    4141                                'args'                      => array( 'text' => 'Some text' ),
    4242                        ),
     
    4444                                'current_attachment_index'  => 4,
    4545                                'expected_attachment_index' => 5,
    46                                 'expected'                  => '<a href=\'http://example.org/?attachment_id=%%ID%%\'><img width="1" height="1" src="' . WP_CONTENT_URL . '/uploads/image5.jpg" class="attachment-thumbnail size-thumbnail" alt="" decoding="async" loading="lazy" /></a>',
     46                                'expected'                  => '<a href=\'http://' . WP_TESTS_DOMAIN . '/?attachment_id=%%ID%%\'><img width="1" height="1" src="' . WP_CONTENT_URL . '/uploads/image5.jpg" class="attachment-thumbnail size-thumbnail" alt="" decoding="async" loading="lazy" /></a>',
    4747                                'args'                      => array( 'prev' => false ),
    4848                        ),
     
    5050                                'current_attachment_index'  => 4,
    5151                                'expected_attachment_index' => 5,
    52                                 'expected'                  => '<a href=\'http://example.org/?attachment_id=%%ID%%\'>Some text</a>',
     52                                'expected'                  => '<a href=\'http://' . WP_TESTS_DOMAIN . '/?attachment_id=%%ID%%\'>Some text</a>',
    5353                                'args'                      => array(
    5454                                        'prev' => false,
  • trunk/tests/phpunit/tests/media/getNextImageLink.php

    r53480 r58097  
    3232                                'current_attachment_index'  => 4,
    3333                                'expected_attachment_index' => 5,
    34                                 'expected'                  => '<a href=\'http://example.org/?attachment_id=%%ID%%\'><img width="1" height="1" src="' . WP_CONTENT_URL . '/uploads/image5.jpg" class="attachment-thumbnail size-thumbnail" alt="" decoding="async" loading="lazy" /></a>',
     34                                'expected'                  => '<a href=\'http://' . WP_TESTS_DOMAIN . '/?attachment_id=%%ID%%\'><img width="1" height="1" src="' . WP_CONTENT_URL . '/uploads/image5.jpg" class="attachment-thumbnail size-thumbnail" alt="" decoding="async" loading="lazy" /></a>',
    3535                        ),
    3636                        'with text when has next link' => array(
    3737                                'current_attachment_index'  => 4,
    3838                                'expected_attachment_index' => 5,
    39                                 'expected'                  => '<a href=\'http://example.org/?attachment_id=%%ID%%\'>Some text</a>',
     39                                'expected'                  => '<a href=\'http://' . WP_TESTS_DOMAIN . '/?attachment_id=%%ID%%\'>Some text</a>',
    4040                                'args'                      => array( 'text' => 'Some text' ),
    4141                        ),
  • trunk/tests/phpunit/tests/media/getPreviousImageLink.php

    r53480 r58097  
    3232                                'current_attachment_index'  => 3,
    3333                                'expected_attachment_index' => 2,
    34                                 'expected'                  => '<a href=\'http://example.org/?attachment_id=%%ID%%\'><img width="1" height="1" src="' . WP_CONTENT_URL . '/uploads/image2.jpg" class="attachment-thumbnail size-thumbnail" alt="" decoding="async" loading="lazy" /></a>',
     34                                'expected'                  => '<a href=\'http://' . WP_TESTS_DOMAIN . '/?attachment_id=%%ID%%\'><img width="1" height="1" src="' . WP_CONTENT_URL . '/uploads/image2.jpg" class="attachment-thumbnail size-thumbnail" alt="" decoding="async" loading="lazy" /></a>',
    3535                        ),
    3636                        'with text when has previous link' => array(
    3737                                'current_attachment_index'  => 3,
    3838                                'expected_attachment_index' => 2,
    39                                 'expected'                  => '<a href=\'http://example.org/?attachment_id=%%ID%%\'>Some text</a>',
     39                                'expected'                  => '<a href=\'http://' . WP_TESTS_DOMAIN . '/?attachment_id=%%ID%%\'>Some text</a>',
    4040                                'args'                      => array( 'text' => 'Some text' ),
    4141                        ),
  • trunk/tests/phpunit/tests/media/nextImageLink.php

    r53480 r58097  
    3131                                'current_attachment_index'  => 4,
    3232                                'expected_attachment_index' => 5,
    33                                 'expected'                  => '<a href=\'http://example.org/?attachment_id=%%ID%%\'><img width="1" height="1" src="' . WP_CONTENT_URL . '/uploads/image5.jpg" class="attachment-thumbnail size-thumbnail" alt="" decoding="async" loading="lazy" /></a>',
     33                                'expected'                  => '<a href=\'http://' . WP_TESTS_DOMAIN . '/?attachment_id=%%ID%%\'><img width="1" height="1" src="' . WP_CONTENT_URL . '/uploads/image5.jpg" class="attachment-thumbnail size-thumbnail" alt="" decoding="async" loading="lazy" /></a>',
    3434                        ),
    3535                        'with text when has next link' => array(
    3636                                'current_attachment_index'  => 4,
    3737                                'expected_attachment_index' => 5,
    38                                 'expected'                  => '<a href=\'http://example.org/?attachment_id=%%ID%%\'>Some text</a>',
     38                                'expected'                  => '<a href=\'http://' . WP_TESTS_DOMAIN . '/?attachment_id=%%ID%%\'>Some text</a>',
    3939                                'args'                      => array( 'text' => 'Some text' ),
    4040                        ),
  • trunk/tests/phpunit/tests/media/previousImageLink.php

    r53480 r58097  
    3131                                'current_attachment_index'  => 3,
    3232                                'expected_attachment_index' => 2,
    33                                 'expected'                  => '<a href=\'http://example.org/?attachment_id=%%ID%%\'><img width="1" height="1" src="' . WP_CONTENT_URL . '/uploads/image2.jpg" class="attachment-thumbnail size-thumbnail" alt="" decoding="async" loading="lazy" /></a>',
     33                                'expected'                  => '<a href=\'http://' . WP_TESTS_DOMAIN . '/?attachment_id=%%ID%%\'><img width="1" height="1" src="' . WP_CONTENT_URL . '/uploads/image2.jpg" class="attachment-thumbnail size-thumbnail" alt="" decoding="async" loading="lazy" /></a>',
    3434                        ),
    3535                        'with text when has previous link' => array(
    3636                                'current_attachment_index'  => 3,
    3737                                'expected_attachment_index' => 2,
    38                                 'expected'                  => '<a href=\'http://example.org/?attachment_id=%%ID%%\'>Some text</a>',
     38                                'expected'                  => '<a href=\'http://' . WP_TESTS_DOMAIN . '/?attachment_id=%%ID%%\'>Some text</a>',
    3939                                'args'                      => array( 'text' => 'Some text' ),
    4040                        ),
  • trunk/tests/phpunit/tests/multisite/site.php

    r57987 r58097  
    11411141                                        ),
    11421142                                ),
     1143                                array(
     1144                                        array(
     1145                                                'domain' => 'example.com:8888',
     1146                                        ),
     1147                                        array(
     1148                                                'domain'     => 'example.com:8888',
     1149                                                'path'       => '/',
     1150                                                'network_id' => 1,
     1151                                                'public'     => 1,
     1152                                                'archived'   => 0,
     1153                                                'mature'     => 0,
     1154                                                'spam'       => 0,
     1155                                                'deleted'    => 0,
     1156                                                'lang_id'    => 0,
     1157                                        ),
     1158                                ),
    11431159                        );
    11441160                }
     
    12431259                                        ),
    12441260                                ),
     1261                                array(
     1262                                        array(
     1263                                                'domain'     => 'example.com:8888',
     1264                                                'network_id' => 2,
     1265                                        ),
     1266                                        array(
     1267                                                'domain'  => 'example.com:8888',
     1268                                                'site_id' => 2,
     1269                                        ),
     1270                                ),
    12451271                        );
    12461272                }
     
    13591385                                        ),
    13601386                                        array(
    1361                                                 'domain' => 'another-invalid-domain.com',
     1387                                                'domain' => 'yetanother-invalid-domain.com',
     1388                                        ),
     1389                                ),
     1390                                array(
     1391                                        array(
     1392                                                'domain' => 'with-port.com:8888',
     1393                                        ),
     1394                                        array(
     1395                                                'domain' => 'with-port.com:8888',
     1396                                        ),
     1397                                ),
     1398                                array(
     1399                                        array(
     1400                                                'domain' => 'subdomain.with-port.com:8888',
     1401                                        ),
     1402                                        array(
     1403                                                'domain' => 'subdomain.with-port.com:8888',
    13621404                                        ),
    13631405                                ),
  • trunk/tests/phpunit/tests/multisite/wpMsUsersListTable.php

    r54215 r58097  
    9999
    100100                $expected = array(
    101                         'all'   => '<a href="http://example.org/wp-admin/network/users.php" class="current" aria-current="page">All <span class="count">(' . $all . ')</span></a>',
    102                         'super' => '<a href="http://example.org/wp-admin/network/users.php?role=super">Super Admin <span class="count">(' . $super . ')</span></a>',
     101                        'all'   => '<a href="http://' . WP_TESTS_DOMAIN . '/wp-admin/network/users.php" class="current" aria-current="page">All <span class="count">(' . $all . ')</span></a>',
     102                        'super' => '<a href="http://' . WP_TESTS_DOMAIN . '/wp-admin/network/users.php?role=super">Super Admin <span class="count">(' . $super . ')</span></a>',
    103103                );
    104104
  • trunk/tests/phpunit/tests/pluggable/wpMail.php

    r55822 r58097  
    222222         */
    223223        public function test_wp_mail_with_empty_from_header() {
     224                // Make sure that we don't add any ports to the from header.
     225                $url_parts = parse_url( 'http://' . WP_TESTS_DOMAIN );
     226
    224227                $to       = 'address@tld.com';
    225228                $subject  = 'Testing';
    226229                $message  = 'Test Message';
    227230                $headers  = 'From: ';
    228                 $expected = 'From: WordPress <wordpress@' . WP_TESTS_DOMAIN . '>';
     231                $expected = 'From: WordPress <wordpress@' . $url_parts['host'] . '>';
    229232
    230233                wp_mail( $to, $subject, $message, $headers );
  • trunk/tests/phpunit/tests/post/wpGetAttachmentLink.php

    r56559 r58097  
    6262                        'no new attributes'                         => array(
    6363                                'attributes' => array(),
    64                                 'expected'   => "<a href='http://example.org/?attachment_id=ATTACHMENT_ID'>",
     64                                'expected'   => "<a href='http://" . WP_TESTS_DOMAIN . "/?attachment_id=ATTACHMENT_ID'>",
    6565                        ),
    6666                        'one new attribute'                         => array(
  • trunk/tests/phpunit/tests/privacy/wpPrivacyGeneratePersonalDataExportFile.php

    r57987 r58097  
    375375                } else {
    376376                        // "About" group: to avoid time difference, use the report's "on" timestamp.
    377                         $about_group = '{"about":{"group_label":"About","group_description":"Overview of export report.","items":{"about-1":[{"name":"Report generated for","value":"' . $request->email . '"},{"name":"For site","value":"Test Blog"},{"name":"At URL","value":"http:\/\/example.org"},{"name":"On","value":"{{TIMESTAMP}}"}]}}';
     377                        $about_group = '{"about":{"group_label":"About","group_description":"Overview of export report.","items":{"about-1":[{"name":"Report generated for","value":"' . $request->email . '"},{"name":"For site","value":"Test Blog"},{"name":"At URL","value":"http:\/\/' . WP_TESTS_DOMAIN . '"},{"name":"On","value":"{{TIMESTAMP}}"}]}}';
    378378                        $expected   .= $this->replace_timestamp_placeholder( $actual_json, $about_group );
    379379                        if ( isset( $expected_content['json'] ) ) {
     
    470470                                'groups'           => array(),
    471471                                'expected_content' => array(
    472                                         'html' => '<h2 id="about-about">About</h2><p>Overview of export report.</p><div><table><tbody><tr><th>Report generated for</th><td>export-requester@example.com</td></tr><tr><th>For site</th><td>Test Blog</td></tr><tr><th>At URL</th><td><a href="http://example.org">http://example.org</a></td></tr><tr><th>On</th><td>{{TIMESTAMP}}</td></tr></tbody></table></div>',
     472                                        'html' => '<h2 id="about-about">About</h2><p>Overview of export report.</p><div><table><tbody><tr><th>Report generated for</th><td>export-requester@example.com</td></tr><tr><th>For site</th><td>Test Blog</td></tr><tr><th>At URL</th><td><a href="http://' . WP_TESTS_DOMAIN . '">http://' . WP_TESTS_DOMAIN . '</a></td></tr><tr><th>On</th><td>{{TIMESTAMP}}</td></tr></tbody></table></div>',
    473473                                ),
    474474                        ),
     
    514514                                ),
    515515                                'expected_content' => array(
    516                                         'html' => '<div id="table_of_contents"><h2>Table of Contents</h2><ul><li><a href="#about-about">About</a></li><li><a href="#user-user">User</a></li></ul></div><h2 id="about-about">About</h2><p>Overview of export report.</p><div><table><tbody><tr><th>Report generated for</th><td>export-requester@example.com</td></tr><tr><th>For site</th><td>Test Blog</td></tr><tr><th>At URL</th><td><a href="http://example.org">http://example.org</a></td></tr><tr><th>On</th><td>{{TIMESTAMP}}</td></tr></tbody></table><div class="return-to-top"><a href="#top"><span aria-hidden="true">&uarr; </span> Go to top</a></div></div><h2 id="user-user">User</h2><p>User&#8217;s profile data.</p><div><table><tbody><tr><th>User ID</th><td>1</td></tr><tr><th>User Login Name</th><td>user_login</td></tr><tr><th>User Nice Name</th><td>User Name</td></tr><tr><th>User Email</th><td>export-requester@example.com</td></tr><tr><th>User Registration Date</th><td>2020-01-31 19:29:29</td></tr><tr><th>User Display Name</th><td>User Name</td></tr><tr><th>User Nickname</th><td>User</td></tr></tbody></table><div class="return-to-top"><a href="#top"><span aria-hidden="true">&uarr; </span> Go to top</a></div></div>',
     516                                        'html' => '<div id="table_of_contents"><h2>Table of Contents</h2><ul><li><a href="#about-about">About</a></li><li><a href="#user-user">User</a></li></ul></div><h2 id="about-about">About</h2><p>Overview of export report.</p><div><table><tbody><tr><th>Report generated for</th><td>export-requester@example.com</td></tr><tr><th>For site</th><td>Test Blog</td></tr><tr><th>At URL</th><td><a href="http://' . WP_TESTS_DOMAIN . '">http://' . WP_TESTS_DOMAIN . '</a></td></tr><tr><th>On</th><td>{{TIMESTAMP}}</td></tr></tbody></table><div class="return-to-top"><a href="#top"><span aria-hidden="true">&uarr; </span> Go to top</a></div></div><h2 id="user-user">User</h2><p>User&#8217;s profile data.</p><div><table><tbody><tr><th>User ID</th><td>1</td></tr><tr><th>User Login Name</th><td>user_login</td></tr><tr><th>User Nice Name</th><td>User Name</td></tr><tr><th>User Email</th><td>export-requester@example.com</td></tr><tr><th>User Registration Date</th><td>2020-01-31 19:29:29</td></tr><tr><th>User Display Name</th><td>User Name</td></tr><tr><th>User Nickname</th><td>User</td></tr></tbody></table><div class="return-to-top"><a href="#top"><span aria-hidden="true">&uarr; </span> Go to top</a></div></div>',
    517517                                        'json' => ',"user":{"group_label":"User","group_description":"User&#8217;s profile data.","items":{"user-1":[{"name":"User ID","value":1},{"name":"User Login Name","value":"user_login"},{"name":"User Nice Name","value":"User Name"},{"name":"User Email","value":"export-requester@example.com"},{"name":"User Registration Date","value":"2020-01-31 19:29:29"},{"name":"User Display Name","value":"User Name"},{"name":"User Nickname","value":"User"}]}}',
    518518                                ),
     
    624624                                ),
    625625                                'expected_content' => array(
    626                                         'html' => '<div id="table_of_contents"><h2>Table of Contents</h2><ul><li><a href="#about-about">About</a></li><li><a href="#user-user">User</a></li><li><a href="#comments-comments">Comments <span class="count">(2)</span></a></li></ul></div><h2 id="about-about">About</h2><p>Overview of export report.</p><div><table><tbody><tr><th>Report generated for</th><td>export-requester@example.com</td></tr><tr><th>For site</th><td>Test Blog</td></tr><tr><th>At URL</th><td><a href="http://example.org">http://example.org</a></td></tr><tr><th>On</th><td>{{TIMESTAMP}}</td></tr></tbody></table><div class="return-to-top"><a href="#top"><span aria-hidden="true">&uarr; </span> Go to top</a></div></div><h2 id="user-user">User</h2><p>User&#8217;s profile data.</p><div><table><tbody><tr><th>User ID</th><td>1</td></tr><tr><th>User Login Name</th><td>user_login</td></tr><tr><th>User Nice Name</th><td>User Name</td></tr><tr><th>User Email</th><td>export-requester@example.com</td></tr><tr><th>User Registration Date</th><td>2020-01-31 19:29:29</td></tr><tr><th>User Display Name</th><td>User Name</td></tr><tr><th>User Nickname</th><td>User</td></tr></tbody></table><div class="return-to-top"><a href="#top"><span aria-hidden="true">&uarr; </span> Go to top</a></div></div><h2 id="comments-comments">Comments <span class="count">(2)</span></h2><p>User&#8217;s comment data.</p><div><table><tbody><tr><th>Comment Author</th><td>User Name</td></tr><tr><th>Comment Author Email</th><td>export-requester@example.com</td></tr><tr><th>Comment Author IP</th><td>::1</td></tr><tr><th>Comment Author User Agent</th><td>Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36</td></tr><tr><th>Comment Date</th><td>2020-01-31 19:55:19</td></tr><tr><th>Comment Content</th><td>Test</td></tr><tr><th>Comment URL</th><td><a href="http://localhost:8888/46894/2020/01/31/hello-world/#comment-2">http://localhost:8888/46894/2020/01/31/hello-world/#comment-2</a></td></tr></tbody></table><table><tbody><tr><th>Comment Author</th><td>User Name</td></tr><tr><th>Comment Author Email</th><td>export-requester@example.com</td></tr><tr><th>Comment Author IP</th><td>::1</td></tr><tr><th>Comment Author User Agent</th><td>Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36</td></tr><tr><th>Comment Date</th><td>2020-01-31 20:55:19</td></tr><tr><th>Comment Content</th><td>Test #2</td></tr><tr><th>Comment URL</th><td><a href="http://localhost:8888/46894/2020/01/31/hello-world/#comment-3">http://localhost:8888/46894/2020/01/31/hello-world/#comment-3</a></td></tr></tbody></table><div class="return-to-top"><a href="#top"><span aria-hidden="true">&uarr; </span> Go to top</a></div></div>',
     626                                        'html' => '<div id="table_of_contents"><h2>Table of Contents</h2><ul><li><a href="#about-about">About</a></li><li><a href="#user-user">User</a></li><li><a href="#comments-comments">Comments <span class="count">(2)</span></a></li></ul></div><h2 id="about-about">About</h2><p>Overview of export report.</p><div><table><tbody><tr><th>Report generated for</th><td>export-requester@example.com</td></tr><tr><th>For site</th><td>Test Blog</td></tr><tr><th>At URL</th><td><a href="http://' . WP_TESTS_DOMAIN . '">http://' . WP_TESTS_DOMAIN . '</a></td></tr><tr><th>On</th><td>{{TIMESTAMP}}</td></tr></tbody></table><div class="return-to-top"><a href="#top"><span aria-hidden="true">&uarr; </span> Go to top</a></div></div><h2 id="user-user">User</h2><p>User&#8217;s profile data.</p><div><table><tbody><tr><th>User ID</th><td>1</td></tr><tr><th>User Login Name</th><td>user_login</td></tr><tr><th>User Nice Name</th><td>User Name</td></tr><tr><th>User Email</th><td>export-requester@example.com</td></tr><tr><th>User Registration Date</th><td>2020-01-31 19:29:29</td></tr><tr><th>User Display Name</th><td>User Name</td></tr><tr><th>User Nickname</th><td>User</td></tr></tbody></table><div class="return-to-top"><a href="#top"><span aria-hidden="true">&uarr; </span> Go to top</a></div></div><h2 id="comments-comments">Comments <span class="count">(2)</span></h2><p>User&#8217;s comment data.</p><div><table><tbody><tr><th>Comment Author</th><td>User Name</td></tr><tr><th>Comment Author Email</th><td>export-requester@example.com</td></tr><tr><th>Comment Author IP</th><td>::1</td></tr><tr><th>Comment Author User Agent</th><td>Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36</td></tr><tr><th>Comment Date</th><td>2020-01-31 19:55:19</td></tr><tr><th>Comment Content</th><td>Test</td></tr><tr><th>Comment URL</th><td><a href="http://localhost:8888/46894/2020/01/31/hello-world/#comment-2">http://localhost:8888/46894/2020/01/31/hello-world/#comment-2</a></td></tr></tbody></table><table><tbody><tr><th>Comment Author</th><td>User Name</td></tr><tr><th>Comment Author Email</th><td>export-requester@example.com</td></tr><tr><th>Comment Author IP</th><td>::1</td></tr><tr><th>Comment Author User Agent</th><td>Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36</td></tr><tr><th>Comment Date</th><td>2020-01-31 20:55:19</td></tr><tr><th>Comment Content</th><td>Test #2</td></tr><tr><th>Comment URL</th><td><a href="http://localhost:8888/46894/2020/01/31/hello-world/#comment-3">http://localhost:8888/46894/2020/01/31/hello-world/#comment-3</a></td></tr></tbody></table><div class="return-to-top"><a href="#top"><span aria-hidden="true">&uarr; </span> Go to top</a></div></div>',
    627627                                        'json' => ',"user":{"group_label":"User","group_description":"User&#8217;s profile data.","items":{"user-1":[{"name":"User ID","value":1},{"name":"User Login Name","value":"user_login"},{"name":"User Nice Name","value":"User Name"},{"name":"User Email","value":"export-requester@example.com"},{"name":"User Registration Date","value":"2020-01-31 19:29:29"},{"name":"User Display Name","value":"User Name"},{"name":"User Nickname","value":"User"}]}},"comments":{"group_label":"Comments","group_description":"User&#8217;s comment data.","items":{"comment-2":[{"name":"Comment Author","value":"User Name"},{"name":"Comment Author Email","value":"export-requester@example.com"},{"name":"Comment Author IP","value":"::1"},{"name":"Comment Author User Agent","value":"Mozilla\/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/79.0.3945.130 Safari\/537.36"},{"name":"Comment Date","value":"2020-01-31 19:55:19"},{"name":"Comment Content","value":"Test"},{"name":"Comment URL","value":"<a href=\"http:\/\/localhost:8888\/46894\/2020\/01\/31\/hello-world\/#comment-2\" target=\"_blank\" rel=\"noopener\">http:\/\/localhost:8888\/46894\/2020\/01\/31\/hello-world\/#comment-2<\/a>"}],"comment-3":[{"name":"Comment Author","value":"User Name"},{"name":"Comment Author Email","value":"export-requester@example.com"},{"name":"Comment Author IP","value":"::1"},{"name":"Comment Author User Agent","value":"Mozilla\/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/79.0.3945.130 Safari\/537.36"},{"name":"Comment Date","value":"2020-01-31 20:55:19"},{"name":"Comment Content","value":"Test #2"},{"name":"Comment URL","value":"<a href=\"http:\/\/localhost:8888\/46894\/2020\/01\/31\/hello-world\/#comment-3\" target=\"_blank\" rel=\"noopener\">http:\/\/localhost:8888\/46894\/2020\/01\/31\/hello-world\/#comment-3<\/a>"}]}}',
    628628                                ),
  • trunk/tests/phpunit/tests/rest-api/rest-schema-setup.php

    r57548 r58097  
    211211
    212212        public function test_build_wp_api_client_fixtures() {
     213                if ( 'example.org' !== WP_TESTS_DOMAIN ) {
     214                        $this->markTestSkipped( 'This test can only be run on example.org' );
     215                }
     216
    213217                // Set up data for individual endpoint responses.  We need to specify
    214218                // lots of different fields on these objects, otherwise the generated
  • trunk/tests/phpunit/tests/rest-api/rest-widgets-controller.php

    r56549 r58097  
    392392                                        'id_base'  => 'rss',
    393393                                        'sidebar'  => 'sidebar-1',
    394                                         'rendered' => '<a class="rsswidget rss-widget-feed" href="https://wordpress.org/news/feed"><img class="rss-widget-icon" style="border:0" width="14" height="14" src="http://example.org/wp-includes/images/rss.png" alt="RSS" loading="lazy" /></a> <a class="rsswidget rss-widget-title" href="https://wordpress.org/news">RSS test</a><ul><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/12/introducing-learn-wordpress/\'>Introducing Learn WordPress</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/12/simone/\'>WordPress 5.6 “Simone”</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/12/state-of-the-word-2020/\'>State of the Word 2020</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/12/the-month-in-wordpress-november-2020/\'>The Month in WordPress: November 2020</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/12/wordpress-5-6-release-candidate-2/\'>WordPress 5.6 Release Candidate 2</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/11/wordpress-5-6-release-candidate/\'>WordPress 5.6 Release Candidate</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/11/wordpress-5-6-beta-4/\'>WordPress 5.6 Beta 4</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/11/wordpress-5-6-beta-3/\'>WordPress 5.6 Beta 3</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/11/the-month-in-wordpress-october-2020/\'>The Month in WordPress: October 2020</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/10/wordpress-5-5-3-maintenance-release/\'>WordPress 5.5.3 Maintenance Release</a></li></ul>',
     394                                        'rendered' => '<a class="rsswidget rss-widget-feed" href="https://wordpress.org/news/feed"><img class="rss-widget-icon" style="border:0" width="14" height="14" src="http://' . WP_TESTS_DOMAIN . '/wp-includes/images/rss.png" alt="RSS" loading="lazy" /></a> <a class="rsswidget rss-widget-title" href="https://wordpress.org/news">RSS test</a><ul><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/12/introducing-learn-wordpress/\'>Introducing Learn WordPress</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/12/simone/\'>WordPress 5.6 “Simone”</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/12/state-of-the-word-2020/\'>State of the Word 2020</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/12/the-month-in-wordpress-november-2020/\'>The Month in WordPress: November 2020</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/12/wordpress-5-6-release-candidate-2/\'>WordPress 5.6 Release Candidate 2</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/11/wordpress-5-6-release-candidate/\'>WordPress 5.6 Release Candidate</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/11/wordpress-5-6-beta-4/\'>WordPress 5.6 Beta 4</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/11/wordpress-5-6-beta-3/\'>WordPress 5.6 Beta 3</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/11/the-month-in-wordpress-october-2020/\'>The Month in WordPress: October 2020</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/10/wordpress-5-5-3-maintenance-release/\'>WordPress 5.5.3 Maintenance Release</a></li></ul>',
    395395                                ),
    396396                                array(
  • trunk/tests/phpunit/tests/user/wpListAuthors.php

    r55444 r58097  
    280280                                array(
    281281                                        'echo'       => false,
    282                                         'feed_image' => WP_TESTS_DOMAIN . '/path/to/a/graphic.png',
     282                                        'feed_image' => 'http://' . WP_TESTS_DOMAIN . '/path/to/a/graphic.png',
    283283                                )
    284284                        )
  • trunk/tests/phpunit/tests/user/wpListUsers.php

    r53489 r58097  
    120120                                        'feed' => 'User feed',
    121121                                ),
    122                                 'expected' => '<li>jane (<a href="http://example.org/?feed=rss2&amp;author=AUTHOR_ID_jane">User feed</a>)</li>' .
    123                                                 '<li>michelle (<a href="http://example.org/?feed=rss2&amp;author=AUTHOR_ID_michelle">User feed</a>)</li>' .
    124                                                 '<li>paul (<a href="http://example.org/?feed=rss2&amp;author=AUTHOR_ID_paul">User feed</a>)</li>' .
    125                                                 '<li>zack (<a href="http://example.org/?feed=rss2&amp;author=AUTHOR_ID_zack">User feed</a>)</li>',
     122                                'expected' => '<li>jane (<a href="http://' . WP_TESTS_DOMAIN . '/?feed=rss2&amp;author=AUTHOR_ID_jane">User feed</a>)</li>' .
     123                                                '<li>michelle (<a href="http://' . WP_TESTS_DOMAIN . '/?feed=rss2&amp;author=AUTHOR_ID_michelle">User feed</a>)</li>' .
     124                                                '<li>paul (<a href="http://' . WP_TESTS_DOMAIN . '/?feed=rss2&amp;author=AUTHOR_ID_paul">User feed</a>)</li>' .
     125                                                '<li>zack (<a href="http://' . WP_TESTS_DOMAIN . '/?feed=rss2&amp;author=AUTHOR_ID_zack">User feed</a>)</li>',
    126126                        ),
    127127                        'the feed of each user and an image' => array(
     
    130130                                        'feed_image' => 'http://example.org/image.jpg',
    131131                                ),
    132                                 'expected' => '<li>jane <a href="http://example.org/?feed=rss2&amp;author=AUTHOR_ID_jane"><img src="http://example.org/image.jpg" style="border: none;" alt="User feed with image" /></a></li>' .
    133                                                 '<li>michelle <a href="http://example.org/?feed=rss2&amp;author=AUTHOR_ID_michelle"><img src="http://example.org/image.jpg" style="border: none;" alt="User feed with image" /></a></li>' .
    134                                                 '<li>paul <a href="http://example.org/?feed=rss2&amp;author=AUTHOR_ID_paul"><img src="http://example.org/image.jpg" style="border: none;" alt="User feed with image" /></a></li>' .
    135                                                 '<li>zack <a href="http://example.org/?feed=rss2&amp;author=AUTHOR_ID_zack"><img src="http://example.org/image.jpg" style="border: none;" alt="User feed with image" /></a></li>',
     132                                'expected' => '<li>jane <a href="http://' . WP_TESTS_DOMAIN . '/?feed=rss2&amp;author=AUTHOR_ID_jane"><img src="http://example.org/image.jpg" style="border: none;" alt="User feed with image" /></a></li>' .
     133                                                '<li>michelle <a href="http://' . WP_TESTS_DOMAIN . '/?feed=rss2&amp;author=AUTHOR_ID_michelle"><img src="http://example.org/image.jpg" style="border: none;" alt="User feed with image" /></a></li>' .
     134                                                '<li>paul <a href="http://' . WP_TESTS_DOMAIN . '/?feed=rss2&amp;author=AUTHOR_ID_paul"><img src="http://example.org/image.jpg" style="border: none;" alt="User feed with image" /></a></li>' .
     135                                                '<li>zack <a href="http://' . WP_TESTS_DOMAIN . '/?feed=rss2&amp;author=AUTHOR_ID_zack"><img src="http://example.org/image.jpg" style="border: none;" alt="User feed with image" /></a></li>',
    136136                        ),
    137137                        'a feed of the specified type'       => array(
     
    140140                                        'feed_type' => 'atom',
    141141                                ),
    142                                 'expected' => '<li>jane (<a href="http://example.org/?feed=atom&amp;author=AUTHOR_ID_jane">User feed as atom</a>)</li>' .
    143                                                 '<li>michelle (<a href="http://example.org/?feed=atom&amp;author=AUTHOR_ID_michelle">User feed as atom</a>)</li>' .
    144                                                 '<li>paul (<a href="http://example.org/?feed=atom&amp;author=AUTHOR_ID_paul">User feed as atom</a>)</li>' .
    145                                                 '<li>zack (<a href="http://example.org/?feed=atom&amp;author=AUTHOR_ID_zack">User feed as atom</a>)</li>',
     142                                'expected' => '<li>jane (<a href="http://' . WP_TESTS_DOMAIN . '/?feed=atom&amp;author=AUTHOR_ID_jane">User feed as atom</a>)</li>' .
     143                                                '<li>michelle (<a href="http://' . WP_TESTS_DOMAIN . '/?feed=atom&amp;author=AUTHOR_ID_michelle">User feed as atom</a>)</li>' .
     144                                                '<li>paul (<a href="http://' . WP_TESTS_DOMAIN . '/?feed=atom&amp;author=AUTHOR_ID_paul">User feed as atom</a>)</li>' .
     145                                                '<li>zack (<a href="http://' . WP_TESTS_DOMAIN . '/?feed=atom&amp;author=AUTHOR_ID_zack">User feed as atom</a>)</li>',
    146146                        ),
    147147                        'no output via echo'                 => array(
  • trunk/tools/local-env/default.template

    r49336 r58097  
    1616        absolute_redirect off;
    1717
     18        if (!-e $request_filename) {
     19                rewrite /wp-admin$ $scheme://$host$request_uri/ permanent;
     20                rewrite ^(/[^/]+)?(/wp-.*) $2 last;
     21                rewrite ^(/[^/]+)?(/.*\.php) $2 last;
     22        }
     23
    1824        location / {
    1925                try_files $uri $uri/ /index.php?$args;
  • trunk/tools/local-env/scripts/install.js

    r57918 r58097  
    3030        .replace( 'yourpasswordhere', 'password' )
    3131        .replace( 'localhost', 'mysql' )
     32        .replace( "'WP_TESTS_DOMAIN', 'example.org'", `'WP_TESTS_DOMAIN', '${process.env.LOCAL_WP_TESTS_DOMAIN}'` )
    3233        .concat( "\ndefine( 'FS_METHOD', 'direct' );\n" );
    3334
     
    3839        .then( () => {
    3940                wp_cli( 'db reset --yes' );
    40                 wp_cli( `core install --title="WordPress Develop" --admin_user=admin --admin_password=password --admin_email=test@test.com --skip-email --url=http://localhost:${process.env.LOCAL_PORT}` );
     41                const installCommand = process.env.LOCAL_MULTISITE === 'true'  ? 'multisite-install' : 'install';
     42                wp_cli( `core ${ installCommand } --title="WordPress Develop" --admin_user=admin --admin_password=password --admin_email=test@test.com --skip-email --url=http://localhost:${process.env.LOCAL_PORT}` );
    4143        } );
    4244
Note: See TracChangeset for help on using the changeset viewer.