$fileResourceMock = $this->createMock(File::class);
$this->assertSame(
- '<iframe src="https://www.youtube.com/embed/7331?autohide=1&controls=2&loop=1&playlist=7331&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
+ '<iframe src="https://www.youtube-nocookie.com/embed/7331?autohide=1&controls=2&loop=1&playlist=7331&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
$this->subject->render($fileResourceMock, '300m', '200', ['controls' => 2, 'loop' => 1])
);
}
$fileResourceMock = $this->createMock(File::class);
$this->assertSame(
- '<iframe src="https://www.youtube.com/embed/7331?autohide=1&controls=2&autoplay=1&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
+ '<iframe src="https://www.youtube-nocookie.com/embed/7331?autohide=1&controls=2&autoplay=1&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
$this->subject->render($fileResourceMock, '300m', '200', ['controls' => 2, 'autoplay' => 1])
);
}
$fileReferenceMock->expects($this->any())->method('getOriginalFile')->willReturn($fileResourceMock);
$this->assertSame(
- '<iframe src="https://www.youtube.com/embed/7331?autohide=1&controls=2&autoplay=1&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
+ '<iframe src="https://www.youtube-nocookie.com/embed/7331?autohide=1&controls=2&autoplay=1&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
$this->subject->render($fileReferenceMock, '300m', '200', ['controls' => 2])
);
}
$fileResourceMock = $this->createMock(File::class);
$this->assertSame(
- '<iframe src="https://www.youtube.com/embed/7331?autohide=1&controls=0&autoplay=1&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
+ '<iframe src="https://www.youtube-nocookie.com/embed/7331?autohide=1&controls=0&autoplay=1&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
$this->subject->render($fileResourceMock, '300m', '200', ['controls' => 0, 'autoplay' => 1])
);
}
{
return [
'no options given' => [
- '<iframe src="https://www.youtube.com/embed/7331?autohide=1&controls=2&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
+ '<iframe src="https://www.youtube-nocookie.com/embed/7331?autohide=1&controls=2&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
null
],
'with option controls = foo as invalid string' => [
- '<iframe src="https://www.youtube.com/embed/7331?autohide=1&controls=2&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
+ '<iframe src="https://www.youtube-nocookie.com/embed/7331?autohide=1&controls=2&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
['controls' => 'foo']
],
'with option controls = true as string' => [
- '<iframe src="https://www.youtube.com/embed/7331?autohide=1&controls=2&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
+ '<iframe src="https://www.youtube-nocookie.com/embed/7331?autohide=1&controls=2&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
['controls' => 'true']
],
'with option controls = false as string' => [
- '<iframe src="https://www.youtube.com/embed/7331?autohide=1&controls=2&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
+ '<iframe src="https://www.youtube-nocookie.com/embed/7331?autohide=1&controls=2&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
['controls' => 'false']
],
'with option controls = true as boolean' => [
- '<iframe src="https://www.youtube.com/embed/7331?autohide=1&controls=1&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
+ '<iframe src="https://www.youtube-nocookie.com/embed/7331?autohide=1&controls=1&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
['controls' => true]
],
'with option controls = false as boolean' => [
- '<iframe src="https://www.youtube.com/embed/7331?autohide=1&controls=2&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
+ '<iframe src="https://www.youtube-nocookie.com/embed/7331?autohide=1&controls=2&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
['controls' => false]
],
'with option controls = 0 as string' => [
- '<iframe src="https://www.youtube.com/embed/7331?autohide=1&controls=0&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
+ '<iframe src="https://www.youtube-nocookie.com/embed/7331?autohide=1&controls=0&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
['controls' => '0']
],
'with option controls = 1 as string' => [
- '<iframe src="https://www.youtube.com/embed/7331?autohide=1&controls=1&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
+ '<iframe src="https://www.youtube-nocookie.com/embed/7331?autohide=1&controls=1&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
['controls' => '1']
],
'with option controls = 2 as string' => [
- '<iframe src="https://www.youtube.com/embed/7331?autohide=1&controls=2&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
+ '<iframe src="https://www.youtube-nocookie.com/embed/7331?autohide=1&controls=2&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
['controls' => '2']
],
'with option controls = 3 as string' => [
- '<iframe src="https://www.youtube.com/embed/7331?autohide=1&controls=2&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
+ '<iframe src="https://www.youtube-nocookie.com/embed/7331?autohide=1&controls=2&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
['controls' => '3']
],
'with option controls = negative number as string' => [
- '<iframe src="https://www.youtube.com/embed/7331?autohide=1&controls=0&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
+ '<iframe src="https://www.youtube-nocookie.com/embed/7331?autohide=1&controls=0&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
['controls' => '-42']
],
'with option controls = 0 as int' => [
- '<iframe src="https://www.youtube.com/embed/7331?autohide=1&controls=0&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
+ '<iframe src="https://www.youtube-nocookie.com/embed/7331?autohide=1&controls=0&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
['controls' => 0]
],
'with option controls = 1 as int' => [
- '<iframe src="https://www.youtube.com/embed/7331?autohide=1&controls=1&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
+ '<iframe src="https://www.youtube-nocookie.com/embed/7331?autohide=1&controls=1&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
['controls' => 1]
],
'with option controls = 2 as int' => [
- '<iframe src="https://www.youtube.com/embed/7331?autohide=1&controls=2&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
+ '<iframe src="https://www.youtube-nocookie.com/embed/7331?autohide=1&controls=2&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
['controls' => 2]
],
'with option controls = 3 as int' => [
- '<iframe src="https://www.youtube.com/embed/7331?autohide=1&controls=2&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
+ '<iframe src="https://www.youtube-nocookie.com/embed/7331?autohide=1&controls=2&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
['controls' => 3]
],
'with option controls = negative number as int' => [
- '<iframe src="https://www.youtube.com/embed/7331?autohide=1&controls=0&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
+ '<iframe src="https://www.youtube-nocookie.com/embed/7331?autohide=1&controls=0&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
['controls' => -42]
],
];
$fileResourceMock = $this->createMock(File::class);
$this->assertSame(
- '<iframe src="https://www.youtube.com/embed/7331?autohide=1&controls=2&rel=0&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
+ '<iframe src="https://www.youtube-nocookie.com/embed/7331?autohide=1&controls=2&rel=0&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
$this->subject->render($fileResourceMock, '300m', '200', ['controls' => 2, 'relatedVideos' => 0])
);
}
$fileResourceMock = $this->createMock(File::class);
$this->assertSame(
- '<iframe src="https://www.youtube.com/embed/7331?autohide=1&controls=0&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen foo="bar" custom-play="preload" width="300" height="200"></iframe>',
+ '<iframe src="https://www.youtube-nocookie.com/embed/7331?autohide=1&controls=0&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen foo="bar" custom-play="preload" width="300" height="200"></iframe>',
$this->subject->render($fileResourceMock, '300m', '200', ['controls' => 0, 'additionalAttributes' => ['foo' => 'bar', 'custom-play' => 'preload']])
);
}
$fileResourceMock = $this->createMock(File::class);
$this->assertSame(
- '<iframe src="https://www.youtube.com/embed/7331?autohide=1&controls=0&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen data-player-handler="youTube" data-custom-playerId="player-123" width="300" height="200"></iframe>',
+ '<iframe src="https://www.youtube-nocookie.com/embed/7331?autohide=1&controls=0&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen data-player-handler="youTube" data-custom-playerId="player-123" width="300" height="200"></iframe>',
$this->subject->render($fileResourceMock, '300m', '200', ['controls' => 0, 'data' => ['player-handler' => 'youTube', 'custom-playerId' => 'player-123']])
);
}
$fileResourceMock = $this->createMock(File::class);
$this->assertSame(
- '<iframe src="https://www.youtube.com/embed/7331?autohide=1&controls=0&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen foo="bar" custom-play="preload" data-player-handler="youTube" data-custom-playerId="player-123" width="300" height="200"></iframe>',
+ '<iframe src="https://www.youtube-nocookie.com/embed/7331?autohide=1&controls=0&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen foo="bar" custom-play="preload" data-player-handler="youTube" data-custom-playerId="player-123" width="300" height="200"></iframe>',
$this->subject->render($fileResourceMock, '300m', '200', ['controls' => 0, 'data' => ['player-handler' => 'youTube', 'custom-playerId' => 'player-123'], 'additionalAttributes' => ['foo' => 'bar', 'custom-play' => 'preload']])
);
}
+
+ /**
+ * @test
+ */
+ public function renderOutputWithDisabledNoCookieIsCorrect()
+ {
+ /** @var File|\PHPUnit_Framework_MockObject_MockObject $fileResourceMock */
+ $fileResourceMock = $this->createMock(File::class);
+
+ $this->assertSame(
+ '<iframe src="https://www.youtube.com/embed/7331?autohide=1&controls=0&enablejsapi=1&origin=http%3A%2F%2Ftest.server.org&showinfo=0" allowfullscreen width="300" height="200"></iframe>',
+ $this->subject->render($fileResourceMock, '300m', '200', ['controls' => 0, 'no-cookie' => 0])
+ );
+ }
}