Skip to content

Commit

Permalink
#20199 Fixed tests for BaseUrl::isRelative() by using rfc3986 complia…
Browse files Browse the repository at this point in the history
…nt uris. Added couple of cases to also test the more relaxed rfc3986 section 3.4 definitions.
  • Loading branch information
enrico.degaudenzi@connectorly.io committed Jun 14, 2024
1 parent 9838b77 commit 9f74eba
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions tests/framework/helpers/BaseUrlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,14 @@ public function ensureSchemeUrlProvider()
'expected result' => 'acme.com?name=bugs.bunny',
],
'relative url and another url as parameter will return input url' => [
'url' => 'acme.com/test?tnt-link=https://tnt.com/',
'url' => 'acme.com/test?tnt-link=https%3A%2F%2Ftnt.com%2F%3Fq%3Dvalue',
'scheme' => 'https',
'expected' => 'acme.com/test?tnt-link=https://tnt.com/',
'expected' => 'acme.com/test?tnt-link=https%3A%2F%2Ftnt.com%2F%3Fq%3Dvalue',
],
'relative url and another url as parameter, using more relaxed rfc3986 3.4, will return input url' => [
'url' => 'acme.com/test?tnt-link=https%3A//tnt.com/?q%3Dvalue',
'scheme' => 'https',
'expected' => 'acme.com/test?tnt-link=https%3A//tnt.com/?q%3Dvalue',
],
'url with scheme not a string will return input url' => [
'url' => 'acme.com?name=bugs.bunny',
Expand Down Expand Up @@ -76,7 +81,10 @@ public function relativeTrueUrlProvider()
'url' => 'acme.com/tnt-room=123',
],
'url without protocol and another url in a parameter value' => [
'url' => 'acme.com?tnt-room-link=https://tnt.com',
'url' => 'acme.com?tnt-room-link=https%3A%2F%2Ftnt.com%2F%3Fq%3Dvalue',
],
'url without protocol and another url in a parameter value, using more relaxed rfc3986 3.4' => [
'url' => 'acme.com?tnt-room-link=https%3A//tnt.com/?q%3Dvalue',
],
'path only' => [
'url' => '/path',
Expand Down

0 comments on commit 9f74eba

Please sign in to comment.