You are here

public static function UrlHelperTest::providerTestStripDangerousProtocols in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 431
Contains \Drupal\Tests\Component\Utility\UrlHelperTest.

Class

UrlHelperTest
@group Utility

Namespace

Drupal\Tests\Component\Utility

Code

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