Changeset 58097
- Timestamp:
- 05/04/2024 07:23:31 PM (6 months ago)
- Location:
- trunk
- Files:
-
- 34 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/.env
r57678 r58097 54 54 LOCAL_DB_VERSION=8.0 55 55 56 # Whether or not to enable multisite. 57 LOCAL_MULTISITE=false 58 56 59 # The debug settings to add to `wp-config.php`. 57 60 LOCAL_WP_DEBUG=true … … 61 64 LOCAL_WP_ENVIRONMENT_TYPE=local 62 65 LOCAL_WP_DEVELOPMENT_MODE=core 66 LOCAL_WP_TESTS_DOMAIN=example.org 63 67 64 68 # The URL to use when running e2e tests. -
trunk/.github/workflows/phpunit-tests-run.yml
r57918 r58097 41 41 type: 'string' 42 42 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' 43 48 report: 44 49 description: 'Whether to report results to WordPress.org Hosting Tests' … … 51 56 LOCAL_DB_VERSION: ${{ inputs.db-version }} 52 57 LOCAL_PHP_MEMCACHED: ${{ inputs.memcached }} 58 LOCAL_WP_TESTS_DOMAIN: ${{ inputs.tests-domain }} 53 59 PHPUNIT_CONFIG: ${{ inputs.phpunit-config }} 54 60 PUPPETEER_SKIP_DOWNLOAD: ${{ true }} … … 75 81 # - Submit the test results to the WordPress.org host test results. 76 82 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 || '' }} 78 84 runs-on: ${{ inputs.os }} 79 85 timeout-minutes: 20 -
trunk/.github/workflows/phpunit-tests.yml
r57985 r58097 49 49 db-type: [ 'mysql' ] 50 50 db-version: [ '5.7', '8.0', '8.1', '8.2', '8.3' ] 51 tests-domain: [ 'example.org' ] 51 52 multisite: [ false, true ] 52 53 memcached: [ false ] … … 58 59 db-type: 'mysql' 59 60 db-version: '5.7' 61 tests-domain: 'example.org' 60 62 multisite: false 61 63 memcached: true … … 64 66 db-type: 'mysql' 65 67 db-version: '5.7' 68 tests-domain: 'example.org' 66 69 multisite: true 67 70 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 68 86 # Report test results to the Host Test Results. 69 87 - os: ubuntu-latest … … 71 89 db-type: 'mysql' 72 90 db-version: '5.7' 91 tests-domain: 'example.org' 73 92 multisite: false 74 93 memcached: false … … 82 101 memcached: ${{ matrix.memcached }} 83 102 phpunit-config: ${{ matrix.multisite && 'tests/phpunit/multisite.xml' || 'phpunit.xml.dist' }} 103 tests-domain: ${{ matrix.tests-domain }} 84 104 report: ${{ matrix.report || false }} 85 105 -
trunk/src/wp-admin/includes/network.php
r57793 r58097 149 149 } 150 150 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() ); 171 153 172 154 echo '<form method="post">'; -
trunk/src/wp-admin/network/site-info.php
r56409 r58097 67 67 68 68 $blog_data['scheme'] = $update_parsed_url['scheme']; 69 70 // Make sure to not lose the port if it was provided. 69 71 $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']; 71 77 } 72 78 … … 89 95 $old_home_url = trailingslashit( esc_url( get_option( 'home' ) ) ); 90 96 $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 ) { 93 100 $new_home_url = untrailingslashit( sanitize_url( $blog_data['scheme'] . '://' . $new_details->domain . $new_details->path ) ); 94 101 update_option( 'home', $new_home_url ); … … 97 104 $old_site_url = trailingslashit( esc_url( get_option( 'siteurl' ) ) ); 98 105 $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 ) { 101 109 $new_site_url = untrailingslashit( sanitize_url( $blog_data['scheme'] . '://' . $new_details->domain . $new_details->path ) ); 102 110 update_option( 'siteurl', $new_site_url ); -
trunk/src/wp-includes/embed.php
r57987 r58097 628 628 array( 629 629 'host' => '', 630 'port' => null, 630 631 'path' => '/', 631 632 ) … … 633 634 634 635 $qv = array( 635 'domain' => $url_parts['host'] ,636 'domain' => $url_parts['host'] . ( $url_parts['port'] ? ':' . $url_parts['port'] : '' ), 636 637 'path' => '/', 637 638 'update_site_meta_cache' => false, -
trunk/src/wp-includes/feed.php
r58096 r58097 661 661 */ 662 662 function 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'] ) ); 665 671 } 666 672 -
trunk/src/wp-includes/media.php
r58037 r58097 1364 1364 * (which is to say, when they share the domain name of the current request). 1365 1365 */ 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 } 1368 1377 } 1369 1378 -
trunk/src/wp-includes/ms-site.php
r56549 r58097 525 525 // Sanitize domain if passed. 526 526 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'] ); 532 528 } 533 529 -
trunk/tests/phpunit/tests/admin/wpCommentsListTable.php
r56559 r58097 205 205 206 206 $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&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&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>', 213 213 ); 214 214 $this->assertSame( $expected, $this->table->get_views() ); -
trunk/tests/phpunit/tests/admin/wpPostCommentsListTable.php
r56547 r58097 27 27 28 28 $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&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&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>', 35 35 ); 36 36 $this->assertSame( $expected, $this->table->get_views() ); -
trunk/tests/phpunit/tests/admin/wpPrivacyRequestsTable.php
r55562 r58097 201 201 public function test_get_views_should_return_views_by_default() { 202 202 $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>', 204 204 ); 205 205 -
trunk/tests/phpunit/tests/date/getPermalink.php
r56971 r58097 36 36 ); 37 37 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 ) ); 39 39 40 40 // phpcs:ignore WordPress.DateTime.RestrictedFunctions.timezone_change_date_default_timezone_set 41 41 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 ) ); 43 43 } 44 44 } -
trunk/tests/phpunit/tests/dependencies/scripts.php
r57981 r58097 496 496 */ 497 497 public function data_provider_to_test_various_strategy_dependency_chains() { 498 $wp_tests_domain = WP_TESTS_DOMAIN; 499 498 500 return array( 499 501 'async-dependent-with-one-blocking-dependency' => array( … … 882 884 }, 883 885 '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> 886 888 <script type='text/javascript' src='https://example.com/theme-functions.js' id='theme-functions-js' defer data-wp-strategy='defer'></script> 887 889 HTML -
trunk/tests/phpunit/tests/functions/referer.php
r56971 r58097 32 32 33 33 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']; 35 37 36 38 return $hosts; -
trunk/tests/phpunit/tests/functions/wpNonceAys.php
r56971 r58097 28 28 public function test_wp_nonce_ays_log_out() { 29 29 $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&_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&_wpnonce=.{10}">log out</a>\?#m' ); 31 31 $this->expectExceptionCode( 403 ); 32 32 -
trunk/tests/phpunit/tests/general/feedLinksExtra.php
r56559 r58097 441 441 $expected = '<link rel="alternate" type="application/rss+xml"'; 442 442 $expected .= ' title="Test Blog » Post with no comments Comments Feed"'; 443 $expected .= ' href="http:// example.org/?feed=rss2&p=' . self::$post_no_comment_id . '" />' . "\n";443 $expected .= ' href="http://' . WP_TESTS_DOMAIN . '/?feed=rss2&p=' . self::$post_no_comment_id . '" />' . "\n"; 444 444 $this->assertSame( $expected, get_echo( 'feed_links_extra' ) ); 445 445 } … … 456 456 $expected = '<link rel="alternate" type="application/rss+xml"'; 457 457 $expected .= ' title="Test Blog » Post with no comments Comments Feed"'; 458 $expected .= ' href="http:// example.org/?feed=rss2&p=' . self::$post_no_comment_id . '" />' . "\n";458 $expected .= ' href="http://' . WP_TESTS_DOMAIN . '/?feed=rss2&p=' . self::$post_no_comment_id . '" />' . "\n"; 459 459 $this->assertSame( $expected, get_echo( 'feed_links_extra' ) ); 460 460 } … … 471 471 $expected = '<link rel="alternate" type="application/rss+xml"'; 472 472 $expected .= ' title="Test Blog » Post with a comment Comments Feed"'; 473 $expected .= ' href="http:// example.org/?feed=rss2&p=' . self::$post_with_comment_id . '" />' . "\n";473 $expected .= ' href="http://' . WP_TESTS_DOMAIN . '/?feed=rss2&p=' . self::$post_with_comment_id . '" />' . "\n"; 474 474 $this->assertSame( $expected, get_echo( 'feed_links_extra' ) ); 475 475 } … … 508 508 $expected = '<link rel="alternate" type="testing/foo"'; 509 509 $expected .= ' title="Test Blog » Post with a comment Comments Feed"'; 510 $expected .= ' href="http:// example.org/?feed=foo&p=' . self::$post_with_comment_id . '" />' . "\n";510 $expected .= ' href="http://' . WP_TESTS_DOMAIN . '/?feed=foo&p=' . self::$post_with_comment_id . '" />' . "\n"; 511 511 $this->assertSame( $expected, get_echo( 'feed_links_extra' ) ); 512 512 } -
trunk/tests/phpunit/tests/kses.php
r57987 r58097 1733 1733 return array( 1734 1734 '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" />', 1737 1737 ), 1738 1738 '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" />', 1740 1740 '', 1741 1741 ), 1742 1742 '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" />', 1745 1745 ), 1746 1746 '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" />', 1749 1749 ), 1750 1750 '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" />', 1753 1753 ), 1754 1754 '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" />', 1756 1756 '', 1757 1757 ), 1758 1758 '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" />', 1760 1760 '', 1761 1761 ), 1762 1762 '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" />', 1764 1764 '', 1765 1765 ), 1766 1766 '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" />', 1769 1769 ), 1770 1770 '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" />', 1773 1773 ), 1774 1774 '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" />', 1776 1776 '', 1777 1777 ), 1778 1778 '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" />', 1780 1780 '', 1781 1781 ), 1782 1782 '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" />', 1784 1784 '', 1785 1785 ), 1786 1786 'no type attribute' => array( 1787 '<object data="https:// example.org/foo.pdf" />',1787 '<object data="https://' . WP_TESTS_DOMAIN . '/foo.pdf" />', 1788 1788 '', 1789 1789 ), 1790 1790 '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" />', 1793 1793 ), 1794 1794 '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" />', 1796 1796 '', 1797 1797 ), 1798 1798 '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" />', 1800 1800 '', 1801 1801 ), 1802 1802 '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" />', 1804 1804 '', 1805 1805 ), 1806 1806 '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" />', 1808 1808 '', 1809 1809 ), 1810 1810 '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" />', 1812 1812 '', 1813 1813 ), … … 1817 1817 ), 1818 1818 '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" />', 1821 1821 ), 1822 1822 ); … … 1869 1869 */ 1870 1870 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']; 1872 1879 $param['url'] = $url_with_port_number; 1873 1880 return $param; -
trunk/tests/phpunit/tests/media/getAdjacentImageLink.php
r53480 r58097 33 33 'current_attachment_index' => 3, 34 34 '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>', 36 36 ), 37 37 'with text when has previous link' => array( 38 38 'current_attachment_index' => 3, 39 39 '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>', 41 41 'args' => array( 'text' => 'Some text' ), 42 42 ), … … 44 44 'current_attachment_index' => 4, 45 45 '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>', 47 47 'args' => array( 'prev' => false ), 48 48 ), … … 50 50 'current_attachment_index' => 4, 51 51 '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>', 53 53 'args' => array( 54 54 'prev' => false, -
trunk/tests/phpunit/tests/media/getNextImageLink.php
r53480 r58097 32 32 'current_attachment_index' => 4, 33 33 '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>', 35 35 ), 36 36 'with text when has next link' => array( 37 37 'current_attachment_index' => 4, 38 38 '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>', 40 40 'args' => array( 'text' => 'Some text' ), 41 41 ), -
trunk/tests/phpunit/tests/media/getPreviousImageLink.php
r53480 r58097 32 32 'current_attachment_index' => 3, 33 33 '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>', 35 35 ), 36 36 'with text when has previous link' => array( 37 37 'current_attachment_index' => 3, 38 38 '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>', 40 40 'args' => array( 'text' => 'Some text' ), 41 41 ), -
trunk/tests/phpunit/tests/media/nextImageLink.php
r53480 r58097 31 31 'current_attachment_index' => 4, 32 32 '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>', 34 34 ), 35 35 'with text when has next link' => array( 36 36 'current_attachment_index' => 4, 37 37 '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>', 39 39 'args' => array( 'text' => 'Some text' ), 40 40 ), -
trunk/tests/phpunit/tests/media/previousImageLink.php
r53480 r58097 31 31 'current_attachment_index' => 3, 32 32 '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>', 34 34 ), 35 35 'with text when has previous link' => array( 36 36 'current_attachment_index' => 3, 37 37 '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>', 39 39 'args' => array( 'text' => 'Some text' ), 40 40 ), -
trunk/tests/phpunit/tests/multisite/site.php
r57987 r58097 1141 1141 ), 1142 1142 ), 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 ), 1143 1159 ); 1144 1160 } … … 1243 1259 ), 1244 1260 ), 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 ), 1245 1271 ); 1246 1272 } … … 1359 1385 ), 1360 1386 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', 1362 1404 ), 1363 1405 ), -
trunk/tests/phpunit/tests/multisite/wpMsUsersListTable.php
r54215 r58097 99 99 100 100 $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>', 103 103 ); 104 104 -
trunk/tests/phpunit/tests/pluggable/wpMail.php
r55822 r58097 222 222 */ 223 223 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 224 227 $to = 'address@tld.com'; 225 228 $subject = 'Testing'; 226 229 $message = 'Test Message'; 227 230 $headers = 'From: '; 228 $expected = 'From: WordPress <wordpress@' . WP_TESTS_DOMAIN. '>';231 $expected = 'From: WordPress <wordpress@' . $url_parts['host'] . '>'; 229 232 230 233 wp_mail( $to, $subject, $message, $headers ); -
trunk/tests/phpunit/tests/post/wpGetAttachmentLink.php
r56559 r58097 62 62 'no new attributes' => array( 63 63 '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'>", 65 65 ), 66 66 'one new attribute' => array( -
trunk/tests/phpunit/tests/privacy/wpPrivacyGeneratePersonalDataExportFile.php
r57987 r58097 375 375 } else { 376 376 // "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}}"}]}}'; 378 378 $expected .= $this->replace_timestamp_placeholder( $actual_json, $about_group ); 379 379 if ( isset( $expected_content['json'] ) ) { … … 470 470 'groups' => array(), 471 471 '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>', 473 473 ), 474 474 ), … … 514 514 ), 515 515 '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">↑ </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>',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">↑ </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>', 517 517 '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"}]}}', 518 518 ), … … 624 624 ), 625 625 '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">↑ </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>',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">↑ </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>', 627 627 '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>"}]}}', 628 628 ), -
trunk/tests/phpunit/tests/rest-api/rest-schema-setup.php
r57548 r58097 211 211 212 212 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 213 217 // Set up data for individual endpoint responses. We need to specify 214 218 // lots of different fields on these objects, otherwise the generated -
trunk/tests/phpunit/tests/rest-api/rest-widgets-controller.php
r56549 r58097 392 392 'id_base' => 'rss', 393 393 '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>', 395 395 ), 396 396 array( -
trunk/tests/phpunit/tests/user/wpListAuthors.php
r55444 r58097 280 280 array( 281 281 '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', 283 283 ) 284 284 ) -
trunk/tests/phpunit/tests/user/wpListUsers.php
r53489 r58097 120 120 'feed' => 'User feed', 121 121 ), 122 'expected' => '<li>jane (<a href="http:// example.org/?feed=rss2&author=AUTHOR_ID_jane">User feed</a>)</li>' .123 '<li>michelle (<a href="http:// example.org/?feed=rss2&author=AUTHOR_ID_michelle">User feed</a>)</li>' .124 '<li>paul (<a href="http:// example.org/?feed=rss2&author=AUTHOR_ID_paul">User feed</a>)</li>' .125 '<li>zack (<a href="http:// example.org/?feed=rss2&author=AUTHOR_ID_zack">User feed</a>)</li>',122 'expected' => '<li>jane (<a href="http://' . WP_TESTS_DOMAIN . '/?feed=rss2&author=AUTHOR_ID_jane">User feed</a>)</li>' . 123 '<li>michelle (<a href="http://' . WP_TESTS_DOMAIN . '/?feed=rss2&author=AUTHOR_ID_michelle">User feed</a>)</li>' . 124 '<li>paul (<a href="http://' . WP_TESTS_DOMAIN . '/?feed=rss2&author=AUTHOR_ID_paul">User feed</a>)</li>' . 125 '<li>zack (<a href="http://' . WP_TESTS_DOMAIN . '/?feed=rss2&author=AUTHOR_ID_zack">User feed</a>)</li>', 126 126 ), 127 127 'the feed of each user and an image' => array( … … 130 130 'feed_image' => 'http://example.org/image.jpg', 131 131 ), 132 '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>' .133 '<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>' .134 '<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>' .135 '<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>',132 '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>' . 133 '<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>' . 134 '<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>' . 135 '<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>', 136 136 ), 137 137 'a feed of the specified type' => array( … … 140 140 'feed_type' => 'atom', 141 141 ), 142 'expected' => '<li>jane (<a href="http:// example.org/?feed=atom&author=AUTHOR_ID_jane">User feed as atom</a>)</li>' .143 '<li>michelle (<a href="http:// example.org/?feed=atom&author=AUTHOR_ID_michelle">User feed as atom</a>)</li>' .144 '<li>paul (<a href="http:// example.org/?feed=atom&author=AUTHOR_ID_paul">User feed as atom</a>)</li>' .145 '<li>zack (<a href="http:// example.org/?feed=atom&author=AUTHOR_ID_zack">User feed as atom</a>)</li>',142 'expected' => '<li>jane (<a href="http://' . WP_TESTS_DOMAIN . '/?feed=atom&author=AUTHOR_ID_jane">User feed as atom</a>)</li>' . 143 '<li>michelle (<a href="http://' . WP_TESTS_DOMAIN . '/?feed=atom&author=AUTHOR_ID_michelle">User feed as atom</a>)</li>' . 144 '<li>paul (<a href="http://' . WP_TESTS_DOMAIN . '/?feed=atom&author=AUTHOR_ID_paul">User feed as atom</a>)</li>' . 145 '<li>zack (<a href="http://' . WP_TESTS_DOMAIN . '/?feed=atom&author=AUTHOR_ID_zack">User feed as atom</a>)</li>', 146 146 ), 147 147 'no output via echo' => array( -
trunk/tools/local-env/default.template
r49336 r58097 16 16 absolute_redirect off; 17 17 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 18 24 location / { 19 25 try_files $uri $uri/ /index.php?$args; -
trunk/tools/local-env/scripts/install.js
r57918 r58097 30 30 .replace( 'yourpasswordhere', 'password' ) 31 31 .replace( 'localhost', 'mysql' ) 32 .replace( "'WP_TESTS_DOMAIN', 'example.org'", `'WP_TESTS_DOMAIN', '${process.env.LOCAL_WP_TESTS_DOMAIN}'` ) 32 33 .concat( "\ndefine( 'FS_METHOD', 'direct' );\n" ); 33 34 … … 38 39 .then( () => { 39 40 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}` ); 41 43 } ); 42 44
Note: See TracChangeset
for help on using the changeset viewer.