function IFrameUrlHelperTest::testIsSecure

Same name in other branches
  1. 9 core/modules/media/tests/src/Unit/IFrameUrlHelperTest.php \Drupal\Tests\media\Unit\IFrameUrlHelperTest::testIsSecure()
  2. 8.9.x core/modules/media/tests/src/Unit/IFrameUrlHelperTest.php \Drupal\Tests\media\Unit\IFrameUrlHelperTest::testIsSecure()
  3. 11.x core/modules/media/tests/src/Unit/IFrameUrlHelperTest.php \Drupal\Tests\media\Unit\IFrameUrlHelperTest::testIsSecure()

Tests that isSecure() behaves properly.

@covers ::isSecure

@dataProvider providerIsSecure

Parameters

string $url: The URL to test for security.

string $base_url: The base URL to compare $url against.

bool $secure: The expected result of isSecure().

File

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

Class

IFrameUrlHelperTest
@coversDefaultClass \Drupal\media\IFrameUrlHelper

Namespace

Drupal\Tests\media\Unit

Code

public function testIsSecure($url, $base_url, $secure) : void {
    $request_context = $this->createMock(RequestContext::class);
    $request_context->expects($this->any())
        ->method('getCompleteBaseUrl')
        ->willReturn($base_url);
    $url_helper = new IFrameUrlHelper($request_context, $this->createMock(PrivateKey::class));
    $this->assertSame($secure, $url_helper->isSecure($url));
}

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