function UrlHelperTest::providerTestStripDangerousProtocols

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php \Drupal\Tests\Component\Utility\UrlHelperTest::providerTestStripDangerousProtocols()
  2. 10 core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php \Drupal\Tests\Component\Utility\UrlHelperTest::providerTestStripDangerousProtocols()
  3. 11.x core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php \Drupal\Tests\Component\Utility\UrlHelperTest::providerTestStripDangerousProtocols()

Provides data for self::testStripDangerousProtocols().

Return value

array

File

core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php, line 507

Class

UrlHelperTest
@group Utility

Namespace

Drupal\Tests\Component\Utility

Code

public static function providerTestStripDangerousProtocols() {
    return [
        [
            'javascript://example.com',
            '//example.com',
            [
                'http',
                'https',
            ],
        ],
        // Test custom protocols.
[
            'http://example.com',
            '//example.com',
            [
                'https',
            ],
        ],
        // Valid protocol.
[
            'http://example.com',
            'http://example.com',
            [
                'https',
                'http',
            ],
        ],
        // Colon not part of the URL scheme.
[
            '/test:8888',
            '/test:8888',
            [
                'http',
            ],
        ],
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.