From 7750458133663a8bae9a36cc36ab29e563675620 Mon Sep 17 00:00:00 2001
From: John Blackbourn ' . sprintf(
- /* translators: %s: Port number. */
- __( 'You cannot use port numbers such as %s.' ),
- '' . $has_ports . '
'
- ) . '
Do you really want to log out\?#m' ); + $this->expectExceptionMessageMatches( '#You are attempting to log out of Test Blog
Do you really want to log out\?#m' );
$this->expectExceptionCode( 403 );
wp_nonce_ays( 'log-out' );
diff --git a/tests/phpunit/tests/general/feedLinksExtra.php b/tests/phpunit/tests/general/feedLinksExtra.php
index 3bea946e1aff1..2711b338e10d5 100644
--- a/tests/phpunit/tests/general/feedLinksExtra.php
+++ b/tests/phpunit/tests/general/feedLinksExtra.php
@@ -440,7 +440,7 @@ public function test_feed_links_extra_should_respect_comments_open() {
$expected = '' . "\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 @@ public function test_feed_links_extra_should_respect_pings_open() {
$expected = '' . "\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 @@ public function test_feed_links_extra_should_respect_post_comment_count() {
$expected = '' . "\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 @@ static function () {
$expected = '' . "\n";
+ $expected .= ' href="http://' . WP_TESTS_DOMAIN . '/?feed=foo&p=' . self::$post_with_comment_id . '" />' . "\n";
$this->assertSame( $expected, get_echo( 'feed_links_extra' ) );
}
diff --git a/tests/phpunit/tests/kses.php b/tests/phpunit/tests/kses.php
index 12a7bbac29a42..06128970f1f5c 100644
--- a/tests/phpunit/tests/kses.php
+++ b/tests/phpunit/tests/kses.php
@@ -1732,83 +1732,83 @@ public function test_wp_kses_object_tag_allowed( $html, $expected ) {
public function data_wp_kses_object_tag_allowed() {
return array(
'valid value for type' => array(
- '',
- '',
+ '',
+ '',
),
'invalid value for type' => array(
- '',
+ '',
'',
),
'multiple type attributes, last invalid' => array(
- '',
- '',
+ '',
+ '',
),
'multiple type attributes, first uppercase, last invalid' => array(
- '',
- '',
+ '',
+ '',
),
'multiple type attributes, last upper case and invalid' => array(
- '',
- '',
+ '',
+ '',
),
'multiple type attributes, first invalid' => array(
- '',
+ '',
'',
),
'multiple type attributes, first upper case and invalid' => array(
- '',
+ '',
'',
),
'multiple type attributes, first invalid, last uppercase' => array(
- '',
+ '',
'',
),
'multiple object tags, last invalid' => array(
- '',
- '',
+ '',
+ '',
),
'multiple object tags, first invalid' => array(
- '',
- '',
+ '',
+ '',
),
'type attribute with partially incorrect value' => array(
- '',
+ '',
'',
),
'type attribute with empty value' => array(
- '',
+ '',
'',
),
'type attribute with no value' => array(
- '',
+ '',
'',
),
'no type attribute' => array(
- '',
+ '',
'',
),
'different protocol in url' => array(
- '',
- '',
+ '',
+ '',
),
'query string on url' => array(
- '',
+ '',
'',
),
'fragment on url' => array(
- '',
+ '',
'',
),
'wrong extension' => array(
- '',
+ '',
'',
),
'protocol-relative url' => array(
- '',
+ '',
'',
),
'unsupported protocol' => array(
- '',
+ '',
'',
),
'relative url' => array(
@@ -1816,8 +1816,8 @@ public function data_wp_kses_object_tag_allowed() {
'',
),
'url with port number-like path' => array(
- '',
- '',
+ '',
+ '',
),
);
}
@@ -1868,7 +1868,14 @@ public function data_wp_kses_object_data_url_with_port_number_allowed() {
* @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;
}
diff --git a/tests/phpunit/tests/media/getAdjacentImageLink.php b/tests/phpunit/tests/media/getAdjacentImageLink.php
index 7f413cab2ed92..c1e8894995271 100644
--- a/tests/phpunit/tests/media/getAdjacentImageLink.php
+++ b/tests/phpunit/tests/media/getAdjacentImageLink.php
@@ -32,24 +32,24 @@ public function data_get_adjacent_image_link() {
'when has previous link' => array(
'current_attachment_index' => 3,
'expected_attachment_index' => 2,
- 'expected' => '',
+ 'expected' => '',
),
'with text when has previous link' => array(
'current_attachment_index' => 3,
'expected_attachment_index' => 2,
- 'expected' => 'Some text',
+ 'expected' => 'Some text',
'args' => array( 'text' => 'Some text' ),
),
'when has next link' => array(
'current_attachment_index' => 4,
'expected_attachment_index' => 5,
- 'expected' => '',
+ 'expected' => '',
'args' => array( 'prev' => false ),
),
'with text when has next link' => array(
'current_attachment_index' => 4,
'expected_attachment_index' => 5,
- 'expected' => 'Some text',
+ 'expected' => 'Some text',
'args' => array(
'prev' => false,
'text' => 'Some text',
diff --git a/tests/phpunit/tests/media/getNextImageLink.php b/tests/phpunit/tests/media/getNextImageLink.php
index b26f1fcd69ec7..3d4ccacc1b307 100644
--- a/tests/phpunit/tests/media/getNextImageLink.php
+++ b/tests/phpunit/tests/media/getNextImageLink.php
@@ -31,12 +31,12 @@ public function data_get_next_image_link() {
'when has next link' => array(
'current_attachment_index' => 4,
'expected_attachment_index' => 5,
- 'expected' => '',
+ 'expected' => '',
),
'with text when has next link' => array(
'current_attachment_index' => 4,
'expected_attachment_index' => 5,
- 'expected' => 'Some text',
+ 'expected' => 'Some text',
'args' => array( 'text' => 'Some text' ),
),
diff --git a/tests/phpunit/tests/media/getPreviousImageLink.php b/tests/phpunit/tests/media/getPreviousImageLink.php
index 36652e75ad622..b2b49d28bca41 100644
--- a/tests/phpunit/tests/media/getPreviousImageLink.php
+++ b/tests/phpunit/tests/media/getPreviousImageLink.php
@@ -31,12 +31,12 @@ public function data_get_previous_image_link() {
'when has previous link' => array(
'current_attachment_index' => 3,
'expected_attachment_index' => 2,
- 'expected' => '',
+ 'expected' => '',
),
'with text when has previous link' => array(
'current_attachment_index' => 3,
'expected_attachment_index' => 2,
- 'expected' => 'Some text',
+ 'expected' => 'Some text',
'args' => array( 'text' => 'Some text' ),
),
diff --git a/tests/phpunit/tests/media/nextImageLink.php b/tests/phpunit/tests/media/nextImageLink.php
index 569e1900ce634..5e2282e43c485 100644
--- a/tests/phpunit/tests/media/nextImageLink.php
+++ b/tests/phpunit/tests/media/nextImageLink.php
@@ -30,12 +30,12 @@ public function data_next_image_link() {
'when has next link' => array(
'current_attachment_index' => 4,
'expected_attachment_index' => 5,
- 'expected' => '',
+ 'expected' => '',
),
'with text when has next link' => array(
'current_attachment_index' => 4,
'expected_attachment_index' => 5,
- 'expected' => 'Some text',
+ 'expected' => 'Some text',
'args' => array( 'text' => 'Some text' ),
),
diff --git a/tests/phpunit/tests/media/previousImageLink.php b/tests/phpunit/tests/media/previousImageLink.php
index c75e08353793e..ae1b18fe3c708 100644
--- a/tests/phpunit/tests/media/previousImageLink.php
+++ b/tests/phpunit/tests/media/previousImageLink.php
@@ -30,12 +30,12 @@ public function data_previous_image_link() {
'when has previous link' => array(
'current_attachment_index' => 3,
'expected_attachment_index' => 2,
- 'expected' => '',
+ 'expected' => '',
),
'with text when has previous link' => array(
'current_attachment_index' => 3,
'expected_attachment_index' => 2,
- 'expected' => 'Some text',
+ 'expected' => 'Some text',
'args' => array( 'text' => 'Some text' ),
),
diff --git a/tests/phpunit/tests/multisite/site.php b/tests/phpunit/tests/multisite/site.php
index 3a2d339c0a150..714035999faaa 100644
--- a/tests/phpunit/tests/multisite/site.php
+++ b/tests/phpunit/tests/multisite/site.php
@@ -1140,6 +1140,22 @@ public function data_wp_insert_site() {
'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 @@ public function data_wp_update_site() {
'lang_id' => 1,
),
),
+ array(
+ array(
+ 'domain' => 'example.com:8888',
+ 'network_id' => 2,
+ ),
+ array(
+ 'domain' => 'example.com:8888',
+ 'site_id' => 2,
+ ),
+ ),
);
}
@@ -1358,7 +1384,23 @@ public function data_wp_normalize_site_data() {
'domain' => ' Overview of export report. Overview of export report. Overview of export report. User’s profile data. Overview of export report. User’s profile data. Overview of export report. User’s profile data. User’s comment data. Overview of export report. User’s profile data. User’s comment data.About
Report generated for export-requester@example.com For site Test Blog At URL http://example.org On {{TIMESTAMP}} About
Report generated for export-requester@example.com For site Test Blog At URL http://' . WP_TESTS_DOMAIN . ' On {{TIMESTAMP}} About
Report generated for export-requester@example.com For site Test Blog At URL http://example.org On {{TIMESTAMP}} User
User ID 1 User Login Name user_login User Nice Name User Name User Email export-requester@example.com User Registration Date 2020-01-31 19:29:29 User Display Name User Name User Nickname User About
Report generated for export-requester@example.com For site Test Blog At URL http://' . WP_TESTS_DOMAIN . ' On {{TIMESTAMP}} User
User ID 1 User Login Name user_login User Nice Name User Name User Email export-requester@example.com User Registration Date 2020-01-31 19:29:29 User Display Name User Name User Nickname User Table of Contents
About
Report generated for export-requester@example.com For site Test Blog At URL http://example.org On {{TIMESTAMP}} User
User ID 1 User Login Name user_login User Nice Name User Name User Email export-requester@example.com User Registration Date 2020-01-31 19:29:29 User Display Name User Name User Nickname User Comments (2)
Comment Author User Name Comment Author Email export-requester@example.com Comment Author IP ::1 Comment Author User Agent 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 Comment Date 2020-01-31 19:55:19 Comment Content Test Comment URL http://localhost:8888/46894/2020/01/31/hello-world/#comment-2 Comment Author User Name Comment Author Email export-requester@example.com Comment Author IP ::1 Comment Author User Agent 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 Comment Date 2020-01-31 20:55:19 Comment Content Test #2 Comment URL http://localhost:8888/46894/2020/01/31/hello-world/#comment-3 Table of Contents
About
Report generated for export-requester@example.com For site Test Blog At URL http://' . WP_TESTS_DOMAIN . ' On {{TIMESTAMP}} User
User ID 1 User Login Name user_login User Nice Name User Name User Email export-requester@example.com User Registration Date 2020-01-31 19:29:29 User Display Name User Name User Nickname User Comments (2)
Comment Author User Name Comment Author Email export-requester@example.com Comment Author IP ::1 Comment Author User Agent 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 Comment Date 2020-01-31 19:55:19 Comment Content Test Comment URL http://localhost:8888/46894/2020/01/31/hello-world/#comment-2 Comment Author User Name Comment Author Email export-requester@example.com Comment Author IP ::1 Comment Author User Agent 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 Comment Date 2020-01-31 20:55:19 Comment Content Test #2 Comment URL http://localhost:8888/46894/2020/01/31/hello-world/#comment-3
',
+ 'rendered' => ' RSS test
',
),
array(
'id' => 'testwidget',
diff --git a/tests/phpunit/tests/user/wpListAuthors.php b/tests/phpunit/tests/user/wpListAuthors.php
index 90a22e39d9edf..f05e534b551cc 100644
--- a/tests/phpunit/tests/user/wpListAuthors.php
+++ b/tests/phpunit/tests/user/wpListAuthors.php
@@ -279,7 +279,7 @@ public function test_wp_list_authors_feed_image() {
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',
)
)
);
diff --git a/tests/phpunit/tests/user/wpListUsers.php b/tests/phpunit/tests/user/wpListUsers.php
index 2d76ad16b27b8..56bcdb5485792 100644
--- a/tests/phpunit/tests/user/wpListUsers.php
+++ b/tests/phpunit/tests/user/wpListUsers.php
@@ -119,30 +119,30 @@ public function data_should_create_a_user_list() {
'args' => array(
'feed' => 'User feed',
),
- 'expected' => '