Skip to content

Commit 9055d16

Browse files
authored
Merge pull request #305 from kmcs/master
Allow YouTube share url
2 parents 4f0d7c0 + 4ef2c13 commit 9055d16

File tree

2 files changed

+52
-41
lines changed

2 files changed

+52
-41
lines changed

src/Providers/OEmbed/Youtube.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44

55
class Youtube extends EndPoint implements EndPointInterface
66
{
7-
protected static $pattern = '*youtube.*';
7+
protected static $pattern = ['*youtube.*', '*youtu\.be.*'];
88
protected static $endPoint = 'http://www.youtube.com/oembed';
99
}

tests/YoutubeTest.php

Lines changed: 51 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,50 +4,61 @@
44

55
class YoutubeTest extends AbstractTestCase
66
{
7+
8+
static private $expectedVideoInfo = [
9+
'title' => 'Noisy kittens waiting for dinner!',
10+
'imageWidth' => 480,
11+
'imageHeight' => 360,
12+
'type' => 'video',
13+
'authorName' => 'smshdchrb',
14+
'authorUrl' => 'https://www.youtube.com/user/smshdchrb',
15+
'providerName' => 'YouTube',
16+
'providerUrl' => 'https://www.youtube.com/',
17+
'tags' => [
18+
'kittens',
19+
'cats',
20+
'hungry',
21+
'cat',
22+
'baby',
23+
'eight',
24+
'weeks',
25+
'old',
26+
'noisy',
27+
'meow',
28+
'funny',
29+
'kitties',
30+
'feline',
31+
'dinner',
32+
'excited',
33+
'loud',
34+
'cute',
35+
'pet',
36+
'food',
37+
'time',
38+
'felix',
39+
'kitty',
40+
'catz',
41+
'lolcat',
42+
'kitten',
43+
'talking',
44+
'adorable',
45+
'climbing'
46+
],
47+
];
48+
749
public function testOne()
850
{
951
$this->assertEmbed(
1052
'http://www.youtube.com/watch?v=eiHXASgRTcA',
11-
[
12-
'title' => 'Noisy kittens waiting for dinner!',
13-
'imageWidth' => 480,
14-
'imageHeight' => 360,
15-
'type' => 'video',
16-
'authorName' => 'smshdchrb',
17-
'authorUrl' => 'https://www.youtube.com/user/smshdchrb',
18-
'providerName' => 'YouTube',
19-
'providerUrl' => 'https://www.youtube.com/',
20-
'tags' => [
21-
'kittens',
22-
'cats',
23-
'hungry',
24-
'cat',
25-
'baby',
26-
'eight',
27-
'weeks',
28-
'old',
29-
'noisy',
30-
'meow',
31-
'funny',
32-
'kitties',
33-
'feline',
34-
'dinner',
35-
'excited',
36-
'loud',
37-
'cute',
38-
'pet',
39-
'food',
40-
'time',
41-
'felix',
42-
'kitty',
43-
'catz',
44-
'lolcat',
45-
'kitten',
46-
'talking',
47-
'adorable',
48-
'climbing'
49-
],
50-
]
53+
self::$expectedVideoInfo
54+
);
55+
}
56+
57+
public function testShareUrl()
58+
{
59+
$this->assertEmbed(
60+
'http://youtu.be/eiHXASgRTcA',
61+
self::$expectedVideoInfo
5162
);
5263
}
5364

0 commit comments

Comments
 (0)