Http only allowed protocol in RedirectDestinationTest

Created on 10 October 2017, over 6 years ago
Updated 14 March 2023, over 1 year ago

Problem/Motivation

My unit tests started failing at a random point in time. I'm running PHPUnit on a container within Bitbucket so it might be possible that something has changed in the configuration / infrastructure of Bitbucket.

My tests started failing with the following messages:

1) Drupal\Tests\Core\Routing\RedirectDestinationTest::testGet with data set #3 (Symfony\Component\HttpFoundation\Request Object (...), '/')
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'/'
+'https://www.drupal.org'
/opt/atlassian/pipelines/agent/build/www/core/tests/Drupal/Tests/Core/Routing/RedirectDestinationTest.php:79
2) Drupal\Tests\Core\Routing\RedirectDestinationTest::testGetAsArray with data set #3 (Symfony\Component\HttpFoundation\Request Object (...), '/')
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array (
-    'destination' => '/'
+    'destination' => 'https://www.drupal.org'
 )
/opt/atlassian/pipelines/agent/build/www/core/tests/Drupal/Tests/Core/Routing/RedirectDestinationTest.php:93

After in-line debugging I noticed that for some reason the value for UrlHelper::$allowedProtocols was set to an array only containing "http". I was never able to reproduce the issue on my local environment or on a docker environment where I tried to replicate the bitbucket pipeline environment (php:latest & drupal install via composer).

Proposed resolution

One solution might be resetting the allowed protocols when loading this test class. I'm not saying that it's the solution, but at least it works for me now.

🐛 Bug report
Status

Needs work

Version

9.5

Component
Routing 

Last updated about 17 hours ago

Created by

🇧🇪Belgium legovaer Duffel

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024