public function UrlHelperTest::testStripDangerousProtocols in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php \Drupal\Tests\Component\Utility\UrlHelperTest::testStripDangerousProtocols()
Tests dangerous url protocol filtering.
@dataProvider providerTestStripDangerousProtocols @covers ::setAllowedProtocols @covers ::stripDangerousProtocols
Parameters
string $uri: Protocol URI.
string $expected: Expected escaped value.
array $protocols: Protocols to allow.
File
- core/
tests/ Drupal/ Tests/ Component/ Utility/ UrlHelperTest.php, line 491
Class
- UrlHelperTest
- @group Utility
Namespace
Drupal\Tests\Component\UtilityCode
public function testStripDangerousProtocols($uri, $expected, $protocols) {
UrlHelper::setAllowedProtocols($protocols);
$stripped = UrlHelper::stripDangerousProtocols($uri);
$this
->assertEquals($expected, $stripped);
}