You are here

public static function UrlHelperTest::providerTestFilterBadProtocol 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::providerTestFilterBadProtocol()
  2. 10 core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php \Drupal\Tests\Component\Utility\UrlHelperTest::providerTestFilterBadProtocol()

Provides data for self::testTestFilterBadProtocol().

Return value

array

File

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

Class

UrlHelperTest
@group Utility

Namespace

Drupal\Tests\Component\Utility

Code

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