function 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[[api-linebreak]]

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.