mirror of
git://develop.git.wordpress.org/
synced 2025-04-27 23:53:02 +02:00
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 git-svn-id: https://develop.svn.wordpress.org/trunk@58097 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
4a256357e9
commit
7750458133
.env
.github/workflows
src
tests/phpunit/tests
admin
date
dependencies
functions
general
kses.phpmedia
getAdjacentImageLink.phpgetNextImageLink.phpgetPreviousImageLink.phpnextImageLink.phppreviousImageLink.php
multisite
pluggable
post
privacy
rest-api
user
tools/local-env
4
.env
4
.env
@ -53,6 +53,9 @@ LOCAL_DB_TYPE=mysql
|
||||
##
|
||||
LOCAL_DB_VERSION=8.0
|
||||
|
||||
# Whether or not to enable multisite.
|
||||
LOCAL_MULTISITE=false
|
||||
|
||||
# The debug settings to add to `wp-config.php`.
|
||||
LOCAL_WP_DEBUG=true
|
||||
LOCAL_WP_DEBUG_LOG=true
|
||||
@ -60,6 +63,7 @@ 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
.github/workflows/phpunit-tests-run.yml
vendored
8
.github/workflows/phpunit-tests-run.yml
vendored
@ -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
|
||||
@ -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 }}
|
||||
|
||||
@ -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
|
||||
|
||||
|
20
.github/workflows/phpunit-tests.yml
vendored
20
.github/workflows/phpunit-tests.yml
vendored
@ -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 ]
|
||||
|
||||
@ -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
|
||||
@ -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 }}
|
||||
|
||||
#
|
||||
|
@ -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">';
|
||||
|
||||
|
@ -66,8 +66,14 @@ if ( isset( $_REQUEST['action'] ) && 'update-site' === $_REQUEST['action'] ) {
|
||||
}
|
||||
|
||||
$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 );
|
||||
@ -88,16 +94,18 @@ if ( isset( $_REQUEST['action'] ) && 'update-site' === $_REQUEST['action'] ) {
|
||||
|
||||
$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 );
|
||||
}
|
||||
|
@ -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,
|
||||
);
|
||||
|
@ -660,8 +660,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'] ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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' );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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.
|
||||
|
@ -204,12 +204,12 @@ OPTIONS;
|
||||
$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&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&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() );
|
||||
}
|
||||
|
@ -26,12 +26,12 @@ class Tests_Admin_wpPostCommentsListTable extends WP_UnitTestCase {
|
||||
$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&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&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() );
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ class Tests_Admin_wpPrivacyRequestsTable extends WP_UnitTestCase {
|
||||
*/
|
||||
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() );
|
||||
|
@ -35,10 +35,10 @@ class Tests_Date_GetPermalink extends WP_UnitTestCase {
|
||||
)
|
||||
);
|
||||
|
||||
$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 ) );
|
||||
}
|
||||
}
|
||||
|
@ -495,6 +495,8 @@ JS;
|
||||
* @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 () {
|
||||
@ -881,8 +883,8 @@ HTML
|
||||
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
|
||||
,
|
||||
|
@ -31,7 +31,9 @@ class Tests_Functions_Referer extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ class Tests_Functions_wpNonceAys extends WP_UnitTestCase {
|
||||
*/
|
||||
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&_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&_wpnonce=.{10}">log out</a>\?#m' );
|
||||
$this->expectExceptionCode( 403 );
|
||||
|
||||
wp_nonce_ays( 'log-out' );
|
||||
|
@ -440,7 +440,7 @@ class Tests_General_FeedLinksExtra extends WP_UnitTestCase {
|
||||
|
||||
$expected = '<link rel="alternate" type="application/rss+xml"';
|
||||
$expected .= ' title="Test Blog » Post with no comments Comments Feed"';
|
||||
$expected .= ' href="http://example.org/?feed=rss2&p=' . self::$post_no_comment_id . '" />' . "\n";
|
||||
$expected .= ' href="http://' . WP_TESTS_DOMAIN . '/?feed=rss2&p=' . self::$post_no_comment_id . '" />' . "\n";
|
||||
$this->assertSame( $expected, get_echo( 'feed_links_extra' ) );
|
||||
}
|
||||
|
||||
@ -455,7 +455,7 @@ class Tests_General_FeedLinksExtra extends WP_UnitTestCase {
|
||||
|
||||
$expected = '<link rel="alternate" type="application/rss+xml"';
|
||||
$expected .= ' title="Test Blog » Post with no comments Comments Feed"';
|
||||
$expected .= ' href="http://example.org/?feed=rss2&p=' . self::$post_no_comment_id . '" />' . "\n";
|
||||
$expected .= ' href="http://' . WP_TESTS_DOMAIN . '/?feed=rss2&p=' . self::$post_no_comment_id . '" />' . "\n";
|
||||
$this->assertSame( $expected, get_echo( 'feed_links_extra' ) );
|
||||
}
|
||||
|
||||
@ -470,7 +470,7 @@ class Tests_General_FeedLinksExtra extends WP_UnitTestCase {
|
||||
|
||||
$expected = '<link rel="alternate" type="application/rss+xml"';
|
||||
$expected .= ' title="Test Blog » Post with a comment Comments Feed"';
|
||||
$expected .= ' href="http://example.org/?feed=rss2&p=' . self::$post_with_comment_id . '" />' . "\n";
|
||||
$expected .= ' href="http://' . WP_TESTS_DOMAIN . '/?feed=rss2&p=' . self::$post_with_comment_id . '" />' . "\n";
|
||||
$this->assertSame( $expected, get_echo( 'feed_links_extra' ) );
|
||||
}
|
||||
|
||||
@ -507,7 +507,7 @@ class Tests_General_FeedLinksExtra extends WP_UnitTestCase {
|
||||
|
||||
$expected = '<link rel="alternate" type="testing/foo"';
|
||||
$expected .= ' title="Test Blog » Post with a comment Comments Feed"';
|
||||
$expected .= ' href="http://example.org/?feed=foo&p=' . self::$post_with_comment_id . '" />' . "\n";
|
||||
$expected .= ' href="http://' . WP_TESTS_DOMAIN . '/?feed=foo&p=' . self::$post_with_comment_id . '" />' . "\n";
|
||||
$this->assertSame( $expected, get_echo( 'feed_links_extra' ) );
|
||||
}
|
||||
|
||||
|
@ -1732,83 +1732,83 @@ EOF;
|
||||
public function data_wp_kses_object_tag_allowed() {
|
||||
return array(
|
||||
'valid value for type' => array(
|
||||
'<object type="application/pdf" data="https://example.org/foo.pdf" />',
|
||||
'<object type="application/pdf" data="https://example.org/foo.pdf" />',
|
||||
'<object type="application/pdf" data="https://' . WP_TESTS_DOMAIN . '/foo.pdf" />',
|
||||
'<object type="application/pdf" data="https://' . WP_TESTS_DOMAIN . '/foo.pdf" />',
|
||||
),
|
||||
'invalid value for type' => array(
|
||||
'<object type="application/exe" data="https://example.org/foo.exe" />',
|
||||
'<object type="application/exe" data="https://' . WP_TESTS_DOMAIN . '/foo.exe" />',
|
||||
'',
|
||||
),
|
||||
'multiple type attributes, last invalid' => array(
|
||||
'<object type="application/pdf" type="application/exe" data="https://example.org/foo.pdf" />',
|
||||
'<object type="application/pdf" data="https://example.org/foo.pdf" />',
|
||||
'<object type="application/pdf" type="application/exe" data="https://' . WP_TESTS_DOMAIN . '/foo.pdf" />',
|
||||
'<object type="application/pdf" data="https://' . WP_TESTS_DOMAIN . '/foo.pdf" />',
|
||||
),
|
||||
'multiple type attributes, first uppercase, last invalid' => array(
|
||||
'<object TYPE="application/pdf" type="application/exe" data="https://example.org/foo.pdf" />',
|
||||
'<object TYPE="application/pdf" data="https://example.org/foo.pdf" />',
|
||||
'<object TYPE="application/pdf" type="application/exe" data="https://' . WP_TESTS_DOMAIN . '/foo.pdf" />',
|
||||
'<object TYPE="application/pdf" data="https://' . WP_TESTS_DOMAIN . '/foo.pdf" />',
|
||||
),
|
||||
'multiple type attributes, last upper case and invalid' => array(
|
||||
'<object type="application/pdf" TYPE="application/exe" data="https://example.org/foo.pdf" />',
|
||||
'<object type="application/pdf" data="https://example.org/foo.pdf" />',
|
||||
'<object type="application/pdf" TYPE="application/exe" data="https://' . WP_TESTS_DOMAIN . '/foo.pdf" />',
|
||||
'<object type="application/pdf" data="https://' . WP_TESTS_DOMAIN . '/foo.pdf" />',
|
||||
),
|
||||
'multiple type attributes, first invalid' => array(
|
||||
'<object type="application/exe" type="application/pdf" data="https://example.org/foo.pdf" />',
|
||||
'<object type="application/exe" type="application/pdf" data="https://' . WP_TESTS_DOMAIN . '/foo.pdf" />',
|
||||
'',
|
||||
),
|
||||
'multiple type attributes, first upper case and invalid' => array(
|
||||
'<object TYPE="application/exe" type="application/pdf" data="https://example.org/foo.pdf" />',
|
||||
'<object TYPE="application/exe" type="application/pdf" data="https://' . WP_TESTS_DOMAIN . '/foo.pdf" />',
|
||||
'',
|
||||
),
|
||||
'multiple type attributes, first invalid, last uppercase' => array(
|
||||
'<object type="application/exe" TYPE="application/pdf" data="https://example.org/foo.pdf" />',
|
||||
'<object type="application/exe" TYPE="application/pdf" data="https://' . WP_TESTS_DOMAIN . '/foo.pdf" />',
|
||||
'',
|
||||
),
|
||||
'multiple object tags, last invalid' => array(
|
||||
'<object type="application/pdf" data="https://example.org/foo.pdf" /><object type="application/exe" data="https://example.org/foo.exe" />',
|
||||
'<object type="application/pdf" data="https://example.org/foo.pdf" />',
|
||||
'<object type="application/pdf" data="https://' . WP_TESTS_DOMAIN . '/foo.pdf" /><object type="application/exe" data="https://' . WP_TESTS_DOMAIN . '/foo.exe" />',
|
||||
'<object type="application/pdf" data="https://' . WP_TESTS_DOMAIN . '/foo.pdf" />',
|
||||
),
|
||||
'multiple object tags, first invalid' => array(
|
||||
'<object type="application/exe" data="https://example.org/foo.exe" /><object type="application/pdf" data="https://example.org/foo.pdf" />',
|
||||
'<object type="application/pdf" data="https://example.org/foo.pdf" />',
|
||||
'<object type="application/exe" data="https://' . WP_TESTS_DOMAIN . '/foo.exe" /><object type="application/pdf" data="https://' . WP_TESTS_DOMAIN . '/foo.pdf" />',
|
||||
'<object type="application/pdf" data="https://' . WP_TESTS_DOMAIN . '/foo.pdf" />',
|
||||
),
|
||||
'type attribute with partially incorrect value' => array(
|
||||
'<object type="application/pdfa" data="https://example.org/foo.pdf" />',
|
||||
'<object type="application/pdfa" data="https://' . WP_TESTS_DOMAIN . '/foo.pdf" />',
|
||||
'',
|
||||
),
|
||||
'type attribute with empty value' => array(
|
||||
'<object type="" data="https://example.org/foo.pdf" />',
|
||||
'<object type="" data="https://' . WP_TESTS_DOMAIN . '/foo.pdf" />',
|
||||
'',
|
||||
),
|
||||
'type attribute with no value' => array(
|
||||
'<object type data="https://example.org/foo.pdf" />',
|
||||
'<object type data="https://' . WP_TESTS_DOMAIN . '/foo.pdf" />',
|
||||
'',
|
||||
),
|
||||
'no type attribute' => array(
|
||||
'<object data="https://example.org/foo.pdf" />',
|
||||
'<object data="https://' . WP_TESTS_DOMAIN . '/foo.pdf" />',
|
||||
'',
|
||||
),
|
||||
'different protocol in url' => array(
|
||||
'<object type="application/pdf" data="http://example.org/foo.pdf" />',
|
||||
'<object type="application/pdf" data="http://example.org/foo.pdf" />',
|
||||
'<object type="application/pdf" data="http://' . WP_TESTS_DOMAIN . '/foo.pdf" />',
|
||||
'<object type="application/pdf" data="http://' . WP_TESTS_DOMAIN . '/foo.pdf" />',
|
||||
),
|
||||
'query string on url' => array(
|
||||
'<object type="application/pdf" data="https://example.org/foo.pdf?lol=.pdf" />',
|
||||
'<object type="application/pdf" data="https://' . WP_TESTS_DOMAIN . '/foo.pdf?lol=.pdf" />',
|
||||
'',
|
||||
),
|
||||
'fragment on url' => array(
|
||||
'<object type="application/pdf" data="https://example.org/foo.pdf#lol.pdf" />',
|
||||
'<object type="application/pdf" data="https://' . WP_TESTS_DOMAIN . '/foo.pdf#lol.pdf" />',
|
||||
'',
|
||||
),
|
||||
'wrong extension' => array(
|
||||
'<object type="application/pdf" data="https://example.org/foo.php" />',
|
||||
'<object type="application/pdf" data="https://' . WP_TESTS_DOMAIN . '/foo.php" />',
|
||||
'',
|
||||
),
|
||||
'protocol-relative url' => array(
|
||||
'<object type="application/pdf" data="//example.org/foo.pdf" />',
|
||||
'<object type="application/pdf" data="//' . WP_TESTS_DOMAIN . '/foo.pdf" />',
|
||||
'',
|
||||
),
|
||||
'unsupported protocol' => array(
|
||||
'<object type="application/pdf" data="ftp://example.org/foo.pdf" />',
|
||||
'<object type="application/pdf" data="ftp://' . WP_TESTS_DOMAIN . '/foo.pdf" />',
|
||||
'',
|
||||
),
|
||||
'relative url' => array(
|
||||
@ -1816,8 +1816,8 @@ EOF;
|
||||
'',
|
||||
),
|
||||
'url with port number-like path' => array(
|
||||
'<object type="application/pdf" data="https://example.org/cat:8888/foo.pdf" />',
|
||||
'<object type="application/pdf" data="https://example.org/cat:8888/foo.pdf" />',
|
||||
'<object type="application/pdf" data="https://' . WP_TESTS_DOMAIN . '/cat:8888/foo.pdf" />',
|
||||
'<object type="application/pdf" data="https://' . WP_TESTS_DOMAIN . '/cat:8888/foo.pdf" />',
|
||||
),
|
||||
);
|
||||
}
|
||||
@ -1868,7 +1868,14 @@ EOF;
|
||||
* @return array $param with a modified `url`.
|
||||
*/
|
||||
public function wp_kses_upload_dir_filter( $param ) {
|
||||
$url_with_port_number = is_string( $param['url'] ) ? str_replace( 'example.org', 'example.org:8888', $param['url'] ) : $param['url'];
|
||||
// Take care to replace the entire domain, including cases where it already has a port number.
|
||||
$parsed = parse_url( $param['url'] );
|
||||
$replace_domain = $parsed['host'];
|
||||
if ( isset( $parsed['port'] ) ) {
|
||||
$replace_domain .= ':' . $parsed['port'];
|
||||
}
|
||||
|
||||
$url_with_port_number = is_string( $param['url'] ) ? str_replace( $replace_domain, 'example.org:8888', $param['url'] ) : $param['url'];
|
||||
$param['url'] = $url_with_port_number;
|
||||
return $param;
|
||||
}
|
||||
|
@ -32,24 +32,24 @@ class Tests_Media_GetAdjacentImageLink extends WP_Test_Adjacent_Image_Link_TestC
|
||||
'when has previous link' => array(
|
||||
'current_attachment_index' => 3,
|
||||
'expected_attachment_index' => 2,
|
||||
'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>',
|
||||
'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>',
|
||||
),
|
||||
'with text when has previous link' => array(
|
||||
'current_attachment_index' => 3,
|
||||
'expected_attachment_index' => 2,
|
||||
'expected' => '<a href=\'http://example.org/?attachment_id=%%ID%%\'>Some text</a>',
|
||||
'expected' => '<a href=\'http://' . WP_TESTS_DOMAIN . '/?attachment_id=%%ID%%\'>Some text</a>',
|
||||
'args' => array( 'text' => 'Some text' ),
|
||||
),
|
||||
'when has next link' => array(
|
||||
'current_attachment_index' => 4,
|
||||
'expected_attachment_index' => 5,
|
||||
'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>',
|
||||
'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>',
|
||||
'args' => array( 'prev' => false ),
|
||||
),
|
||||
'with text when has next link' => array(
|
||||
'current_attachment_index' => 4,
|
||||
'expected_attachment_index' => 5,
|
||||
'expected' => '<a href=\'http://example.org/?attachment_id=%%ID%%\'>Some text</a>',
|
||||
'expected' => '<a href=\'http://' . WP_TESTS_DOMAIN . '/?attachment_id=%%ID%%\'>Some text</a>',
|
||||
'args' => array(
|
||||
'prev' => false,
|
||||
'text' => 'Some text',
|
||||
|
@ -31,12 +31,12 @@ class Tests_Media_GetNextImageLink extends WP_Test_Adjacent_Image_Link_TestCase
|
||||
'when has next link' => array(
|
||||
'current_attachment_index' => 4,
|
||||
'expected_attachment_index' => 5,
|
||||
'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>',
|
||||
'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>',
|
||||
),
|
||||
'with text when has next link' => array(
|
||||
'current_attachment_index' => 4,
|
||||
'expected_attachment_index' => 5,
|
||||
'expected' => '<a href=\'http://example.org/?attachment_id=%%ID%%\'>Some text</a>',
|
||||
'expected' => '<a href=\'http://' . WP_TESTS_DOMAIN . '/?attachment_id=%%ID%%\'>Some text</a>',
|
||||
'args' => array( 'text' => 'Some text' ),
|
||||
),
|
||||
|
||||
|
@ -31,12 +31,12 @@ class Tests_Media_GetPreviousImageLink extends WP_Test_Adjacent_Image_Link_TestC
|
||||
'when has previous link' => array(
|
||||
'current_attachment_index' => 3,
|
||||
'expected_attachment_index' => 2,
|
||||
'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>',
|
||||
'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>',
|
||||
),
|
||||
'with text when has previous link' => array(
|
||||
'current_attachment_index' => 3,
|
||||
'expected_attachment_index' => 2,
|
||||
'expected' => '<a href=\'http://example.org/?attachment_id=%%ID%%\'>Some text</a>',
|
||||
'expected' => '<a href=\'http://' . WP_TESTS_DOMAIN . '/?attachment_id=%%ID%%\'>Some text</a>',
|
||||
'args' => array( 'text' => 'Some text' ),
|
||||
),
|
||||
|
||||
|
@ -30,12 +30,12 @@ class Tests_Media_NextImageLink extends WP_Test_Adjacent_Image_Link_TestCase {
|
||||
'when has next link' => array(
|
||||
'current_attachment_index' => 4,
|
||||
'expected_attachment_index' => 5,
|
||||
'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>',
|
||||
'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>',
|
||||
),
|
||||
'with text when has next link' => array(
|
||||
'current_attachment_index' => 4,
|
||||
'expected_attachment_index' => 5,
|
||||
'expected' => '<a href=\'http://example.org/?attachment_id=%%ID%%\'>Some text</a>',
|
||||
'expected' => '<a href=\'http://' . WP_TESTS_DOMAIN . '/?attachment_id=%%ID%%\'>Some text</a>',
|
||||
'args' => array( 'text' => 'Some text' ),
|
||||
),
|
||||
|
||||
|
@ -30,12 +30,12 @@ class Tests_Media_PreviousImageLink extends WP_Test_Adjacent_Image_Link_TestCase
|
||||
'when has previous link' => array(
|
||||
'current_attachment_index' => 3,
|
||||
'expected_attachment_index' => 2,
|
||||
'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>',
|
||||
'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>',
|
||||
),
|
||||
'with text when has previous link' => array(
|
||||
'current_attachment_index' => 3,
|
||||
'expected_attachment_index' => 2,
|
||||
'expected' => '<a href=\'http://example.org/?attachment_id=%%ID%%\'>Some text</a>',
|
||||
'expected' => '<a href=\'http://' . WP_TESTS_DOMAIN . '/?attachment_id=%%ID%%\'>Some text</a>',
|
||||
'args' => array( 'text' => 'Some text' ),
|
||||
),
|
||||
|
||||
|
@ -1140,6 +1140,22 @@ if ( is_multisite() ) :
|
||||
'lang_id' => 1,
|
||||
),
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'domain' => 'example.com:8888',
|
||||
),
|
||||
array(
|
||||
'domain' => 'example.com:8888',
|
||||
'path' => '/',
|
||||
'network_id' => 1,
|
||||
'public' => 1,
|
||||
'archived' => 0,
|
||||
'mature' => 0,
|
||||
'spam' => 0,
|
||||
'deleted' => 0,
|
||||
'lang_id' => 0,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@ -1242,6 +1258,16 @@ if ( is_multisite() ) :
|
||||
'lang_id' => 1,
|
||||
),
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'domain' => 'example.com:8888',
|
||||
'network_id' => 2,
|
||||
),
|
||||
array(
|
||||
'domain' => 'example.com:8888',
|
||||
'site_id' => 2,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@ -1358,7 +1384,23 @@ if ( is_multisite() ) :
|
||||
'domain' => '<yet>/another-invalid-domain.com',
|
||||
),
|
||||
array(
|
||||
'domain' => 'another-invalid-domain.com',
|
||||
'domain' => 'yetanother-invalid-domain.com',
|
||||
),
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'domain' => 'with-port.com:8888',
|
||||
),
|
||||
array(
|
||||
'domain' => 'with-port.com:8888',
|
||||
),
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'domain' => 'subdomain.with-port.com:8888',
|
||||
),
|
||||
array(
|
||||
'domain' => 'subdomain.with-port.com:8888',
|
||||
),
|
||||
),
|
||||
array(
|
||||
|
@ -98,8 +98,8 @@ class Tests_Multisite_wpMsUsersListTable extends WP_UnitTestCase {
|
||||
$super = count( get_super_admins() );
|
||||
|
||||
$expected = array(
|
||||
'all' => '<a href="http://example.org/wp-admin/network/users.php" class="current" aria-current="page">All <span class="count">(' . $all . ')</span></a>',
|
||||
'super' => '<a href="http://example.org/wp-admin/network/users.php?role=super">Super Admin <span class="count">(' . $super . ')</span></a>',
|
||||
'all' => '<a href="http://' . WP_TESTS_DOMAIN . '/wp-admin/network/users.php" class="current" aria-current="page">All <span class="count">(' . $all . ')</span></a>',
|
||||
'super' => '<a href="http://' . WP_TESTS_DOMAIN . '/wp-admin/network/users.php?role=super">Super Admin <span class="count">(' . $super . ')</span></a>',
|
||||
);
|
||||
|
||||
$this->assertSame( $expected, $this->table->get_views() );
|
||||
|
@ -221,11 +221,14 @@ class Tests_Pluggable_wpMail extends WP_UnitTestCase {
|
||||
* @ticket 30266
|
||||
*/
|
||||
public function test_wp_mail_with_empty_from_header() {
|
||||
// Make sure that we don't add any ports to the from header.
|
||||
$url_parts = parse_url( 'http://' . WP_TESTS_DOMAIN );
|
||||
|
||||
$to = 'address@tld.com';
|
||||
$subject = 'Testing';
|
||||
$message = 'Test Message';
|
||||
$headers = 'From: ';
|
||||
$expected = 'From: WordPress <wordpress@' . WP_TESTS_DOMAIN . '>';
|
||||
$expected = 'From: WordPress <wordpress@' . $url_parts['host'] . '>';
|
||||
|
||||
wp_mail( $to, $subject, $message, $headers );
|
||||
|
||||
|
@ -61,7 +61,7 @@ class Tests_Post_WpGetAttachmentLink extends WP_UnitTestCase {
|
||||
return array(
|
||||
'no new attributes' => array(
|
||||
'attributes' => array(),
|
||||
'expected' => "<a href='http://example.org/?attachment_id=ATTACHMENT_ID'>",
|
||||
'expected' => "<a href='http://" . WP_TESTS_DOMAIN . "/?attachment_id=ATTACHMENT_ID'>",
|
||||
),
|
||||
'one new attribute' => array(
|
||||
'attributes' => array(
|
||||
|
@ -374,7 +374,7 @@ class Tests_Privacy_wpPrivacyGeneratePersonalDataExportFile extends WP_UnitTestC
|
||||
$expected .= 'null}';
|
||||
} else {
|
||||
// "About" group: to avoid time difference, use the report's "on" timestamp.
|
||||
$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}}"}]}}';
|
||||
$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}}"}]}}';
|
||||
$expected .= $this->replace_timestamp_placeholder( $actual_json, $about_group );
|
||||
if ( isset( $expected_content['json'] ) ) {
|
||||
$expected .= $expected_content['json'];
|
||||
@ -469,7 +469,7 @@ class Tests_Privacy_wpPrivacyGeneratePersonalDataExportFile extends WP_UnitTestC
|
||||
'should contain only about when empty array' => array(
|
||||
'groups' => array(),
|
||||
'expected_content' => array(
|
||||
'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>',
|
||||
'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>',
|
||||
),
|
||||
),
|
||||
// Happy path.
|
||||
@ -513,7 +513,7 @@ class Tests_Privacy_wpPrivacyGeneratePersonalDataExportFile extends WP_UnitTestC
|
||||
),
|
||||
),
|
||||
'expected_content' => array(
|
||||
'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">↑ </span> Go to top</a></div></div><h2 id="user-user">User</h2><p>User’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">↑ </span> Go to top</a></div></div>',
|
||||
'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">↑ </span> Go to top</a></div></div><h2 id="user-user">User</h2><p>User’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">↑ </span> Go to top</a></div></div>',
|
||||
'json' => ',"user":{"group_label":"User","group_description":"User’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"}]}}',
|
||||
),
|
||||
),
|
||||
@ -623,7 +623,7 @@ class Tests_Privacy_wpPrivacyGeneratePersonalDataExportFile extends WP_UnitTestC
|
||||
),
|
||||
),
|
||||
'expected_content' => array(
|
||||
'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">↑ </span> Go to top</a></div></div><h2 id="user-user">User</h2><p>User’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">↑ </span> Go to top</a></div></div><h2 id="comments-comments">Comments <span class="count">(2)</span></h2><p>User’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">↑ </span> Go to top</a></div></div>',
|
||||
'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">↑ </span> Go to top</a></div></div><h2 id="user-user">User</h2><p>User’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">↑ </span> Go to top</a></div></div><h2 id="comments-comments">Comments <span class="count">(2)</span></h2><p>User’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">↑ </span> Go to top</a></div></div>',
|
||||
'json' => ',"user":{"group_label":"User","group_description":"User’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’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>"}]}}',
|
||||
),
|
||||
),
|
||||
|
@ -210,6 +210,10 @@ class WP_Test_REST_Schema_Initialization extends WP_Test_REST_TestCase {
|
||||
}
|
||||
|
||||
public function test_build_wp_api_client_fixtures() {
|
||||
if ( 'example.org' !== WP_TESTS_DOMAIN ) {
|
||||
$this->markTestSkipped( 'This test can only be run on example.org' );
|
||||
}
|
||||
|
||||
// Set up data for individual endpoint responses. We need to specify
|
||||
// lots of different fields on these objects, otherwise the generated
|
||||
// fixture file will be different between runs of PHPUnit tests, which
|
||||
|
@ -391,7 +391,7 @@ class WP_Test_REST_Widgets_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
'id' => 'rss-1',
|
||||
'id_base' => 'rss',
|
||||
'sidebar' => 'sidebar-1',
|
||||
'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>',
|
||||
'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>',
|
||||
),
|
||||
array(
|
||||
'id' => 'testwidget',
|
||||
|
@ -279,7 +279,7 @@ class Tests_User_wpListAuthors extends WP_UnitTestCase {
|
||||
wp_list_authors(
|
||||
array(
|
||||
'echo' => false,
|
||||
'feed_image' => WP_TESTS_DOMAIN . '/path/to/a/graphic.png',
|
||||
'feed_image' => 'http://' . WP_TESTS_DOMAIN . '/path/to/a/graphic.png',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
@ -119,30 +119,30 @@ class Tests_User_wpListUsers extends WP_UnitTestCase {
|
||||
'args' => array(
|
||||
'feed' => 'User feed',
|
||||
),
|
||||
'expected' => '<li>jane (<a href="http://example.org/?feed=rss2&author=AUTHOR_ID_jane">User feed</a>)</li>' .
|
||||
'<li>michelle (<a href="http://example.org/?feed=rss2&author=AUTHOR_ID_michelle">User feed</a>)</li>' .
|
||||
'<li>paul (<a href="http://example.org/?feed=rss2&author=AUTHOR_ID_paul">User feed</a>)</li>' .
|
||||
'<li>zack (<a href="http://example.org/?feed=rss2&author=AUTHOR_ID_zack">User feed</a>)</li>',
|
||||
'expected' => '<li>jane (<a href="http://' . WP_TESTS_DOMAIN . '/?feed=rss2&author=AUTHOR_ID_jane">User feed</a>)</li>' .
|
||||
'<li>michelle (<a href="http://' . WP_TESTS_DOMAIN . '/?feed=rss2&author=AUTHOR_ID_michelle">User feed</a>)</li>' .
|
||||
'<li>paul (<a href="http://' . WP_TESTS_DOMAIN . '/?feed=rss2&author=AUTHOR_ID_paul">User feed</a>)</li>' .
|
||||
'<li>zack (<a href="http://' . WP_TESTS_DOMAIN . '/?feed=rss2&author=AUTHOR_ID_zack">User feed</a>)</li>',
|
||||
),
|
||||
'the feed of each user and an image' => array(
|
||||
'args' => array(
|
||||
'feed' => 'User feed with image',
|
||||
'feed_image' => 'http://example.org/image.jpg',
|
||||
),
|
||||
'expected' => '<li>jane <a href="http://example.org/?feed=rss2&author=AUTHOR_ID_jane"><img src="http://example.org/image.jpg" style="border: none;" alt="User feed with image" /></a></li>' .
|
||||
'<li>michelle <a href="http://example.org/?feed=rss2&author=AUTHOR_ID_michelle"><img src="http://example.org/image.jpg" style="border: none;" alt="User feed with image" /></a></li>' .
|
||||
'<li>paul <a href="http://example.org/?feed=rss2&author=AUTHOR_ID_paul"><img src="http://example.org/image.jpg" style="border: none;" alt="User feed with image" /></a></li>' .
|
||||
'<li>zack <a href="http://example.org/?feed=rss2&author=AUTHOR_ID_zack"><img src="http://example.org/image.jpg" style="border: none;" alt="User feed with image" /></a></li>',
|
||||
'expected' => '<li>jane <a href="http://' . WP_TESTS_DOMAIN . '/?feed=rss2&author=AUTHOR_ID_jane"><img src="http://example.org/image.jpg" style="border: none;" alt="User feed with image" /></a></li>' .
|
||||
'<li>michelle <a href="http://' . WP_TESTS_DOMAIN . '/?feed=rss2&author=AUTHOR_ID_michelle"><img src="http://example.org/image.jpg" style="border: none;" alt="User feed with image" /></a></li>' .
|
||||
'<li>paul <a href="http://' . WP_TESTS_DOMAIN . '/?feed=rss2&author=AUTHOR_ID_paul"><img src="http://example.org/image.jpg" style="border: none;" alt="User feed with image" /></a></li>' .
|
||||
'<li>zack <a href="http://' . WP_TESTS_DOMAIN . '/?feed=rss2&author=AUTHOR_ID_zack"><img src="http://example.org/image.jpg" style="border: none;" alt="User feed with image" /></a></li>',
|
||||
),
|
||||
'a feed of the specified type' => array(
|
||||
'args' => array(
|
||||
'feed' => 'User feed as atom',
|
||||
'feed_type' => 'atom',
|
||||
),
|
||||
'expected' => '<li>jane (<a href="http://example.org/?feed=atom&author=AUTHOR_ID_jane">User feed as atom</a>)</li>' .
|
||||
'<li>michelle (<a href="http://example.org/?feed=atom&author=AUTHOR_ID_michelle">User feed as atom</a>)</li>' .
|
||||
'<li>paul (<a href="http://example.org/?feed=atom&author=AUTHOR_ID_paul">User feed as atom</a>)</li>' .
|
||||
'<li>zack (<a href="http://example.org/?feed=atom&author=AUTHOR_ID_zack">User feed as atom</a>)</li>',
|
||||
'expected' => '<li>jane (<a href="http://' . WP_TESTS_DOMAIN . '/?feed=atom&author=AUTHOR_ID_jane">User feed as atom</a>)</li>' .
|
||||
'<li>michelle (<a href="http://' . WP_TESTS_DOMAIN . '/?feed=atom&author=AUTHOR_ID_michelle">User feed as atom</a>)</li>' .
|
||||
'<li>paul (<a href="http://' . WP_TESTS_DOMAIN . '/?feed=atom&author=AUTHOR_ID_paul">User feed as atom</a>)</li>' .
|
||||
'<li>zack (<a href="http://' . WP_TESTS_DOMAIN . '/?feed=atom&author=AUTHOR_ID_zack">User feed as atom</a>)</li>',
|
||||
),
|
||||
'no output via echo' => array(
|
||||
'args' => array(
|
||||
|
@ -15,6 +15,12 @@ server {
|
||||
|
||||
absolute_redirect off;
|
||||
|
||||
if (!-e $request_filename) {
|
||||
rewrite /wp-admin$ $scheme://$host$request_uri/ permanent;
|
||||
rewrite ^(/[^/]+)?(/wp-.*) $2 last;
|
||||
rewrite ^(/[^/]+)?(/.*\.php) $2 last;
|
||||
}
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php?$args;
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ const testConfig = readFileSync( 'wp-tests-config-sample.php', 'utf8' )
|
||||
.replace( 'yourusernamehere', 'root' )
|
||||
.replace( 'yourpasswordhere', 'password' )
|
||||
.replace( 'localhost', 'mysql' )
|
||||
.replace( "'WP_TESTS_DOMAIN', 'example.org'", `'WP_TESTS_DOMAIN', '${process.env.LOCAL_WP_TESTS_DOMAIN}'` )
|
||||
.concat( "\ndefine( 'FS_METHOD', 'direct' );\n" );
|
||||
|
||||
writeFileSync( 'wp-tests-config.php', testConfig );
|
||||
@ -37,7 +38,8 @@ writeFileSync( 'wp-tests-config.php', testConfig );
|
||||
wait_on( { resources: [ `tcp:localhost:${process.env.LOCAL_PORT}`] } )
|
||||
.then( () => {
|
||||
wp_cli( 'db reset --yes' );
|
||||
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}` );
|
||||
const installCommand = process.env.LOCAL_MULTISITE === 'true' ? 'multisite-install' : 'install';
|
||||
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}` );
|
||||
} );
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user