.../lib/Drupal/filter/Tests/FilterHtmlImageSecureTest.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/core/modules/filter/lib/Drupal/filter/Tests/FilterHtmlImageSecureTest.php b/core/modules/filter/lib/Drupal/filter/Tests/FilterHtmlImageSecureTest.php index b9105de..8ef4822 100644 --- a/core/modules/filter/lib/Drupal/filter/Tests/FilterHtmlImageSecureTest.php +++ b/core/modules/filter/lib/Drupal/filter/Tests/FilterHtmlImageSecureTest.php @@ -74,7 +74,7 @@ function setUp() { * Tests removal of images having a non-local source. */ function testImageSource() { - global $base_url; + global $base_url, $base_root; $public_files_path = PublicStream::basePath(); @@ -95,10 +95,13 @@ function testImageSource() { // Create a list of test image sources. // The keys become the value of the IMG 'src' attribute, the values are the // expected filter conversions. + $test_environment_parts = parse_url($http_base_url); $images = array( $http_base_url . '/' . $druplicon => base_path() . $druplicon, - // Test a url that includes the port. - str_replace(base_path(), ':80' . base_path(), $http_base_url) . '/' . $druplicon => base_path() . $druplicon, + // Test a url that includes the port; if the current testing environment + // does not contain a port, then it must be using port 80 and we can + // generate an equivalent URL that does contain it. + ((isset($test_environment_parts['port'])) ? $http_base_url : $base_root . ':80' . base_path()) . '/' . $druplicon => base_path() . $druplicon, $https_base_url . '/' . $druplicon => base_path() . $druplicon, base_path() . $druplicon => base_path() . $druplicon, $files_path . '/' . $test_image => $files_path . '/' . $test_image,