You are here

public function IFrameUrlHelperTest::providerIsSecure in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/media/tests/src/Unit/IFrameUrlHelperTest.php \Drupal\Tests\media\Unit\IFrameUrlHelperTest::providerIsSecure()

Data provider for testIsSecure().

Return value

array

See also

::testIsSecure()

File

core/modules/media/tests/src/Unit/IFrameUrlHelperTest.php, line 24

Class

IFrameUrlHelperTest
@coversDefaultClass \Drupal\media\IFrameUrlHelper

Namespace

Drupal\Tests\media\Unit

Code

public function providerIsSecure() {
  return [
    'no domain' => [
      '/path/to/media.php',
      'http://www.example.com/',
      FALSE,
    ],
    'no base URL domain' => [
      'http://www.example.com/media.php',
      '/invalid/base/url',
      FALSE,
    ],
    'same domain' => [
      'http://www.example.com/media.php',
      'http://www.example.com/',
      FALSE,
    ],
    'different domain' => [
      'http://www.example.com/media.php',
      'http://www.example-assets.com/',
      TRUE,
    ],
    'same subdomain' => [
      'http://foo.example.com/media.php',
      'http://foo.example.com/',
      FALSE,
    ],
    'different subdomain' => [
      'http://assets.example.com/media.php',
      'http://foo.example.com/',
      TRUE,
    ],
    'subdomain and top-level domain' => [
      'http://assets.example.com/media.php',
      'http://example.com/',
      TRUE,
    ],
  ];
}