You are here

public static function UrlHelperTest::providerTestStripDangerousProtocols in Drupal 8

Same name and namespace in other branches
  1. 9 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()

Provides data for self::testStripDangerousProtocols().

Return value

array

File

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

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',
      ],
    ],
  ];
}