Chris@17: [ Chris@17: '/path/to/media.php', Chris@17: 'http://www.example.com/', Chris@17: FALSE, Chris@17: ], Chris@17: 'no base URL domain' => [ Chris@17: 'http://www.example.com/media.php', Chris@17: '/invalid/base/url', Chris@17: FALSE, Chris@17: ], Chris@17: 'same domain' => [ Chris@17: 'http://www.example.com/media.php', Chris@17: 'http://www.example.com/', Chris@17: FALSE, Chris@17: ], Chris@17: 'different domain' => [ Chris@17: 'http://www.example.com/media.php', Chris@17: 'http://www.example-assets.com/', Chris@17: TRUE, Chris@17: ], Chris@17: 'same subdomain' => [ Chris@17: 'http://foo.example.com/media.php', Chris@17: 'http://foo.example.com/', Chris@17: FALSE, Chris@17: ], Chris@17: 'different subdomain' => [ Chris@17: 'http://assets.example.com/media.php', Chris@17: 'http://foo.example.com/', Chris@17: TRUE, Chris@17: ], Chris@17: 'subdomain and top-level domain' => [ Chris@17: 'http://assets.example.com/media.php', Chris@17: 'http://example.com/', Chris@17: TRUE, Chris@17: ], Chris@17: ]; Chris@17: } Chris@17: Chris@17: /** Chris@17: * Tests that isSecure() behaves properly. Chris@17: * Chris@17: * @param string $url Chris@17: * The URL to test for security. Chris@17: * @param string $base_url Chris@17: * The base URL to compare $url against. Chris@17: * @param bool $secure Chris@17: * The expected result of isSecure(). Chris@17: * Chris@17: * @covers ::isSecure Chris@17: * Chris@17: * @dataProvider providerIsSecure Chris@17: */ Chris@17: public function testIsSecure($url, $base_url, $secure) { Chris@17: $request_context = $this->prophesize(RequestContext::class); Chris@17: $request_context->getCompleteBaseUrl()->willReturn($base_url); Chris@17: $url_helper = new IFrameUrlHelper( Chris@17: $request_context->reveal(), Chris@17: $this->prophesize(PrivateKey::class)->reveal() Chris@17: ); Chris@17: Chris@17: $this->assertSame($secure, $url_helper->isSecure($url)); Chris@17: } Chris@17: Chris@17: }