Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Ports on Multisite Domains #5675

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
2bc890f
Support Port in Site Creation
ObliviousHarmony Nov 15, 2023
1d364ae
Prevent Site Info Port Removal
ObliviousHarmony Nov 15, 2023
c8fc3d7
Allow Ports in Network Setup
ObliviousHarmony Nov 15, 2023
1dc19d7
Added Multisite Environment Support
ObliviousHarmony Nov 15, 2023
fd6b613
Linting Fixes
ObliviousHarmony Nov 15, 2023
d340f12
Fixed Multisite Test
ObliviousHarmony Nov 15, 2023
b7c1877
Merge branch 'trunk' into fix/multisite-port
swissspidy Feb 7, 2024
7153a91
Removed Unnecessary Subdomain Port Removal
ObliviousHarmony Feb 7, 2024
e18f6fa
Merge branch 'trunk' into fix/multisite-port
ObliviousHarmony Feb 7, 2024
7e50f18
Replaced Hard-Coded Test Domains
ObliviousHarmony Feb 8, 2024
94e49bc
Added Support For `.env` `WP_TESTS_DOMAIN`
ObliviousHarmony Feb 8, 2024
0987a6a
Added Missing Multisite oEmbed Port
ObliviousHarmony Feb 8, 2024
d2c692d
Added Missing RSS Link Port
ObliviousHarmony Feb 8, 2024
388648b
Check Port When Securing Calculated `srcset`
ObliviousHarmony Feb 8, 2024
ddb65a6
Added `WP_TESTS_DOMAIN` To GitHub Workflows
ObliviousHarmony Feb 8, 2024
9f8295b
Merge branch 'trunk' into fix/multisite-port
johnbillion Apr 4, 2024
2198839
Let's see if we can get this workflow running.
johnbillion Apr 4, 2024
6c03534
Add the test domain to the job name when its value is not the default.
johnbillion Apr 4, 2024
4ed7743
Merge branch 'trunk' into fix/multisite-port
johnbillion May 2, 2024
988cec7
Merge branch 'trunk' into fix/multisite-port
johnbillion May 2, 2024
0665ca4
Skip running the REST API client fixture tests when using a non-defau…
johnbillion May 2, 2024
49365cb
Account for port when changing a site path.
johnbillion May 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,17 @@ LOCAL_DB_TYPE=mysql
##
LOCAL_DB_VERSION=8.0

# Whether or not to enable multisite.
LOCAL_MULTISITE=false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this now available, would it make sense to turn this to true for the multisite test jobs for PHPUnit?

If not, then we should at least have some type of test that ensures the environment starts and works when multisite is enabled. That could potentially be a separate workflow that tests all of the related local environment commands, and perhaps better off as a separate ticket.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's worth keeping in mind that PHPUnit tests create their own tables and wp-config.php file. The environment variable just switches install to multisite-install and it wouldn't have any effect on the PHPUnit tests.

It's probably not worth creating a test for installing since all it does is run multisite-install instead of install. The rewrite rule change is covered by the existing test workflows and the parsing is covered by PHPUnit tests.


# The debug settings to add to `wp-config.php`.
LOCAL_WP_DEBUG=true
LOCAL_WP_DEBUG_LOG=true
LOCAL_WP_DEBUG_DISPLAY=true
LOCAL_SCRIPT_DEBUG=true
LOCAL_WP_ENVIRONMENT_TYPE=local
LOCAL_WP_DEVELOPMENT_MODE=core
LOCAL_WP_TESTS_DOMAIN=example.org

# The URL to use when running e2e tests.
WP_BASE_URL=http://localhost:${LOCAL_PORT}
8 changes: 7 additions & 1 deletion .github/workflows/phpunit-tests-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ on:
required: false
type: 'string'
default: 'phpunit.xml.dist'
tests-domain:
description: 'The domain to use for the tests'
required: false
type: 'string'
default: 'example.org'
report:
description: 'Whether to report results to WordPress.org Hosting Tests'
required: false
Expand All @@ -50,6 +55,7 @@ env:
LOCAL_DB_TYPE: ${{ inputs.db-type }}
LOCAL_DB_VERSION: ${{ inputs.db-version }}
LOCAL_PHP_MEMCACHED: ${{ inputs.memcached }}
LOCAL_WP_TESTS_DOMAIN: ${{ inputs.tests-domain }}
PHPUNIT_CONFIG: ${{ inputs.phpunit-config }}
PUPPETEER_SKIP_DOWNLOAD: ${{ true }}

Expand All @@ -74,7 +80,7 @@ jobs:
# - Checks out the WordPress Test reporter repository.
# - Submit the test results to the WordPress.org host test results.
phpunit-tests:
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)' || '' }}
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 || '' }}
runs-on: ${{ inputs.os }}
timeout-minutes: 20

Expand Down
22 changes: 21 additions & 1 deletion .github/workflows/phpunit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
#
test-with-mysql:
name: PHP ${{ matrix.php }}
uses: WordPress/wordpress-develop/.github/workflows/phpunit-tests-run.yml@trunk
uses: ObliviousHarmony/wordpress-develop/.github/workflows/phpunit-tests-run.yml@fix/multisite-port
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just noting @johnbillion that this needs to be changed back before merging so that it doesn't break the workflow. We don't need to run actions using a random contributor's branch 😄

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks :D

permissions:
contents: read
secrets: inherit
Expand All @@ -48,6 +48,7 @@ jobs:
php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ]
db-type: [ 'mysql' ]
db-version: [ '5.7', '8.0', '8.1', '8.2', '8.3' ]
tests-domain: [ 'example.org' ]
multisite: [ false, true ]
memcached: [ false ]

Expand All @@ -57,19 +58,37 @@ jobs:
php: '7.4'
db-type: 'mysql'
db-version: '5.7'
tests-domain: 'example.org'
multisite: false
memcached: true
- os: ubuntu-latest
php: '7.4'
db-type: 'mysql'
db-version: '5.7'
tests-domain: 'example.org'
multisite: true
memcached: true
# Include jobs with a port on the test domain for both single and multisite.
- os: ubuntu-latest
php: '7.4'
db-type: 'mysql'
db-version: '5.7'
tests-domain: 'example.org:8889'
multisite: false
memcached: false
- os: ubuntu-latest
php: '7.4'
db-type: 'mysql'
db-version: '5.7'
tests-domain: 'example.org:8889'
multisite: true
memcached: false
# Report test results to the Host Test Results.
- os: ubuntu-latest
php: '7.4'
db-type: 'mysql'
db-version: '5.7'
tests-domain: 'example.org'
multisite: false
memcached: false
report: true
Expand All @@ -81,6 +100,7 @@ jobs:
multisite: ${{ matrix.multisite }}
memcached: ${{ matrix.memcached }}
phpunit-config: ${{ matrix.multisite && 'tests/phpunit/multisite.xml' || 'phpunit.xml.dist' }}
tests-domain: ${{ matrix.tests-domain }}
report: ${{ matrix.report || false }}

#
Expand Down
22 changes: 2 additions & 20 deletions src/wp-admin/includes/network.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,26 +148,8 @@ function network_step1( $errors = false ) {
die();
}

$hostname = get_clean_basedomain();
$has_ports = strstr( $hostname, ':' );
if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ), true ) ) ) {
wp_admin_notice(
'<strong>' . __( 'Error:' ) . '</strong> ' . __( 'You cannot install a network of sites with your server address.' ),
array(
'additional_classes' => array( 'error' ),
)
);

echo '<p>' . sprintf(
/* translators: %s: Port number. */
__( 'You cannot use port numbers such as %s.' ),
'<code>' . $has_ports . '</code>'
) . '</p>';
echo '<a href="' . esc_url( admin_url() ) . '">' . __( 'Go to Dashboard' ) . '</a>';
echo '</div>';
require_once ABSPATH . 'wp-admin/admin-footer.php';
die();
}
// Strip standard port from hostname.
$hostname = preg_replace( '/(?::80|:443)$/', '', get_clean_basedomain() );

echo '<form method="post">';

Expand Down
14 changes: 11 additions & 3 deletions src/wp-admin/network/site-info.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,14 @@
}

$blog_data['scheme'] = $update_parsed_url['scheme'];

// Make sure to not lose the port if it was provided.
$blog_data['domain'] = $update_parsed_url['host'];
$blog_data['path'] = $update_parsed_url['path'];
if ( isset( $update_parsed_url['port'] ) ) {
$blog_data['domain'] .= ':' . $update_parsed_url['port'];
}

$blog_data['path'] = $update_parsed_url['path'];
}

$existing_details = get_site( $id );
Expand All @@ -88,16 +94,18 @@

$old_home_url = trailingslashit( esc_url( get_option( 'home' ) ) );
$old_home_parsed = parse_url( $old_home_url );
$old_home_host = $old_home_parsed['host'] . ( isset( $old_home_parsed['port'] ) ? ':' . $old_home_parsed['port'] : '' );

if ( $old_home_parsed['host'] === $existing_details->domain && $old_home_parsed['path'] === $existing_details->path ) {
if ( $old_home_host === $existing_details->domain && $old_home_parsed['path'] === $existing_details->path ) {
$new_home_url = untrailingslashit( sanitize_url( $blog_data['scheme'] . '://' . $new_details->domain . $new_details->path ) );
update_option( 'home', $new_home_url );
}

$old_site_url = trailingslashit( esc_url( get_option( 'siteurl' ) ) );
$old_site_parsed = parse_url( $old_site_url );
$old_site_host = $old_site_parsed['host'] . ( isset( $old_site_parsed['port'] ) ? ':' . $old_site_parsed['port'] : '' );

if ( $old_site_parsed['host'] === $existing_details->domain && $old_site_parsed['path'] === $existing_details->path ) {
if ( $old_site_host === $existing_details->domain && $old_site_parsed['path'] === $existing_details->path ) {
$new_site_url = untrailingslashit( sanitize_url( $blog_data['scheme'] . '://' . $new_details->domain . $new_details->path ) );
update_option( 'siteurl', $new_site_url );
}
Expand Down
3 changes: 2 additions & 1 deletion src/wp-includes/embed.php
Original file line number Diff line number Diff line change
Expand Up @@ -627,12 +627,13 @@ function get_oembed_response_data_for_url( $url, $args ) {
wp_parse_url( $url ),
array(
'host' => '',
'port' => null,
'path' => '/',
)
);

$qv = array(
'domain' => $url_parts['host'],
'domain' => $url_parts['host'] . ( $url_parts['port'] ? ':' . $url_parts['port'] : '' ),
'path' => '/',
'update_site_meta_cache' => false,
);
Expand Down
10 changes: 8 additions & 2 deletions src/wp-includes/feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -658,8 +658,14 @@ function rss2_site_icon() {
* @return string Correct link for the atom:self element.
*/
function get_self_link() {
$host = parse_url( home_url() );
return set_url_scheme( 'http://' . $host['host'] . wp_unslash( $_SERVER['REQUEST_URI'] ) );
$parsed = parse_url( home_url() );

$domain = $parsed['host'];
if ( isset( $parsed['port'] ) ) {
$domain .= ':' . $parsed['port'];
}

return set_url_scheme( 'http://' . $domain . wp_unslash( $_SERVER['REQUEST_URI'] ) );
}

/**
Expand Down
13 changes: 11 additions & 2 deletions src/wp-includes/media.php
Original file line number Diff line number Diff line change
Expand Up @@ -1363,8 +1363,17 @@ function wp_calculate_image_srcset( $size_array, $image_src, $image_meta, $attac
* If currently on HTTPS, prefer HTTPS URLs when we know they're supported by the domain
* (which is to say, when they share the domain name of the current request).
*/
if ( is_ssl() && ! str_starts_with( $image_baseurl, 'https' ) && parse_url( $image_baseurl, PHP_URL_HOST ) === $_SERVER['HTTP_HOST'] ) {
$image_baseurl = set_url_scheme( $image_baseurl, 'https' );
if ( is_ssl() && ! str_starts_with( $image_baseurl, 'https' ) ) {
// Since the `Host:` header might contain a port we should
// compare it against the image URL using the same port.
$parsed = parse_url( $image_baseurl );
$domain = $parsed['host'];
if ( isset( $parsed['port'] ) ) {
$domain .= ':' . $parsed['port'];
}
if ( $_SERVER['HTTP_HOST'] === $domain ) {
$image_baseurl = set_url_scheme( $image_baseurl, 'https' );
}
}

/*
Expand Down
6 changes: 1 addition & 5 deletions src/wp-includes/ms-site.php
Original file line number Diff line number Diff line change
Expand Up @@ -524,11 +524,7 @@ function wp_prepare_site_data( $data, $defaults, $old_site = null ) {
function wp_normalize_site_data( $data ) {
// Sanitize domain if passed.
if ( array_key_exists( 'domain', $data ) ) {
$data['domain'] = trim( $data['domain'] );
$data['domain'] = preg_replace( '/\s+/', '', sanitize_user( $data['domain'], true ) );
if ( is_subdomain_install() ) {
$data['domain'] = str_replace( '@', '', $data['domain'] );
}
$data['domain'] = preg_replace( '/[^a-z0-9\-.:]+/i', '', $data['domain'] );
}

// Sanitize path if passed.
Expand Down
12 changes: 6 additions & 6 deletions tests/phpunit/tests/admin/wpCommentsListTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,12 @@ public function test_get_views_should_return_views_by_default() {
$this->table->prepare_items();

$expected = array(
'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>',
'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>',
'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>',
'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>',
'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>',
'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>',
'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>',
'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>',
'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>',
'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>',
'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>',
'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>',
);
$this->assertSame( $expected, $this->table->get_views() );
}
Expand Down
12 changes: 6 additions & 6 deletions tests/phpunit/tests/admin/wpPostCommentsListTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ public function test_get_views_should_return_views_by_default() {
$this->table->prepare_items();

$expected = array(
'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>',
'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>',
'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>',
'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>',
'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>',
'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>',
'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>',
'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>',
'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>',
'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>',
'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>',
'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>',
);
$this->assertSame( $expected, $this->table->get_views() );
}
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/tests/admin/wpPrivacyRequestsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ public function data_columns_should_be_sortable() {
*/
public function test_get_views_should_return_views_by_default() {
$expected = array(
'all' => '<a href="http://example.org/wp-admin/export-personal-data.php" class="current" aria-current="page">All <span class="count">(0)</span></a>',
'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>',
);

$this->assertSame( $expected, $this->get_mocked_class_instance()->get_views() );
Expand Down
4 changes: 2 additions & 2 deletions tests/phpunit/tests/date/getPermalink.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ public function test_should_return_correct_date_permalink_with_changed_time_zone
)
);

$this->assertSame( 'http://example.org/2018/07/22/21/13/23', get_permalink( $post_id ) );
$this->assertSame( 'http://' . WP_TESTS_DOMAIN . '/2018/07/22/21/13/23', get_permalink( $post_id ) );

// phpcs:ignore WordPress.DateTime.RestrictedFunctions.timezone_change_date_default_timezone_set
date_default_timezone_set( $timezone );
$this->assertSame( 'http://example.org/2018/07/22/21/13/23', get_permalink( $post_id ) );
$this->assertSame( 'http://' . WP_TESTS_DOMAIN . '/2018/07/22/21/13/23', get_permalink( $post_id ) );
}
}
6 changes: 4 additions & 2 deletions tests/phpunit/tests/dependencies/scripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,8 @@ protected function add_test_inline_script( $handle, $position ) {
* @return array[]
*/
public function data_provider_to_test_various_strategy_dependency_chains() {
$wp_tests_domain = WP_TESTS_DOMAIN;

return array(
'async-dependent-with-one-blocking-dependency' => array(
'set_up' => function () {
Expand Down Expand Up @@ -881,8 +883,8 @@ public function data_provider_to_test_various_strategy_dependency_chains() {
wp_enqueue_script( 'theme-functions', 'https://example.com/theme-functions.js', array( 'jquery' ), null, array( 'strategy' => 'defer' ) );
},
'expected_markup' => <<<HTML
<script type='text/javascript' src='http://example.org/wp-includes/js/jquery/jquery.js' id='jquery-core-js' defer data-wp-strategy='defer'></script>
<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>
<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>
<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>
<script type='text/javascript' src='https://example.com/theme-functions.js' id='theme-functions-js' defer data-wp-strategy='defer'></script>
HTML
,
Expand Down
4 changes: 3 additions & 1 deletion tests/phpunit/tests/functions/referer.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ public function _fake_subfolder_install() {
}

public function filter_allowed_redirect_hosts( $hosts ) {
$hosts[] = 'another.' . WP_TESTS_DOMAIN;
// Make sure we're only using the hostname and not anything else that might be in the WP_TESTS_DOMAIN.
$parsed = parse_url( 'http://' . WP_TESTS_DOMAIN );
$hosts[] = 'another.' . $parsed['host'];

return $hosts;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/tests/functions/wpNonceAys.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function test_wp_nonce_ays() {
*/
public function test_wp_nonce_ays_log_out() {
$this->expectException( 'WPDieException' );
$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' );
$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' );
$this->expectExceptionCode( 403 );

wp_nonce_ays( 'log-out' );
Expand Down
8 changes: 4 additions & 4 deletions tests/phpunit/tests/general/feedLinksExtra.php
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ public function test_feed_links_extra_should_respect_comments_open() {

$expected = '<link rel="alternate" type="application/rss+xml"';
$expected .= ' title="Test Blog &raquo; Post with no comments Comments Feed"';
$expected .= ' href="http://example.org/?feed=rss2&#038;p=' . self::$post_no_comment_id . '" />' . "\n";
$expected .= ' href="http://' . WP_TESTS_DOMAIN . '/?feed=rss2&#038;p=' . self::$post_no_comment_id . '" />' . "\n";
$this->assertSame( $expected, get_echo( 'feed_links_extra' ) );
}

Expand All @@ -455,7 +455,7 @@ public function test_feed_links_extra_should_respect_pings_open() {

$expected = '<link rel="alternate" type="application/rss+xml"';
$expected .= ' title="Test Blog &raquo; Post with no comments Comments Feed"';
$expected .= ' href="http://example.org/?feed=rss2&#038;p=' . self::$post_no_comment_id . '" />' . "\n";
$expected .= ' href="http://' . WP_TESTS_DOMAIN . '/?feed=rss2&#038;p=' . self::$post_no_comment_id . '" />' . "\n";
$this->assertSame( $expected, get_echo( 'feed_links_extra' ) );
}

Expand All @@ -470,7 +470,7 @@ public function test_feed_links_extra_should_respect_post_comment_count() {

$expected = '<link rel="alternate" type="application/rss+xml"';
$expected .= ' title="Test Blog &raquo; Post with a comment Comments Feed"';
$expected .= ' href="http://example.org/?feed=rss2&#038;p=' . self::$post_with_comment_id . '" />' . "\n";
$expected .= ' href="http://' . WP_TESTS_DOMAIN . '/?feed=rss2&#038;p=' . self::$post_with_comment_id . '" />' . "\n";
$this->assertSame( $expected, get_echo( 'feed_links_extra' ) );
}

Expand Down Expand Up @@ -507,7 +507,7 @@ static function () {

$expected = '<link rel="alternate" type="testing/foo"';
$expected .= ' title="Test Blog &raquo; Post with a comment Comments Feed"';
$expected .= ' href="http://example.org/?feed=foo&#038;p=' . self::$post_with_comment_id . '" />' . "\n";
$expected .= ' href="http://' . WP_TESTS_DOMAIN . '/?feed=foo&#038;p=' . self::$post_with_comment_id . '" />' . "\n";
$this->assertSame( $expected, get_echo( 'feed_links_extra' ) );
}

Expand Down
Loading
Loading