Skip to content

Commit

Permalink
Fix return of large Youtube thumbnail (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
drmonkeyninja authored Feb 9, 2018
1 parent 6a0acec commit 070bb3f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/View/Helper/VideoHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ public function youtubeThumbnail($url, $size = 'thumb', $options = [])
'maxres' => 'maxresdefault'
];

if (empty($acceptedSizes[$size]) === true) {
if (! isset($acceptedSizes[$size]) === true) {
return;
}

Expand Down
5 changes: 5 additions & 0 deletions tests/TestCase/View/Helper/VideoHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,9 @@ public function testYouTubeThumbnail()
$expected = '';
$this->assertEquals($expected, $this->Video->youtubeThumbnail('https://www.youtube.com/watch?v=heNGFmEQVq0', 'small'));
}

public function testYouTubeThumbnailCanReturnLargeImage() {
$expected = '<img src="//i.ytimg.com/vi/heNGFmEQVq0/0.jpg" alt=""/>';
$this->assertEquals($expected, $this->Video->youtubeThumbnail('https://www.youtube.com/watch?v=heNGFmEQVq0', 'large'));
}
}

0 comments on commit 070bb3f

Please sign in to comment.