Skip to content

Commit a06a333

Browse files
committed
bug on get the image in soundcloud fixes #52
1 parent ea5d7d1 commit a06a333

File tree

6 files changed

+18
-6
lines changed

6 files changed

+18
-6
lines changed

src/Adapters/Adapter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,8 @@ public function getImage()
321321
if ($this->config['getBiggerImage']) {
322322
$images = $this->images;
323323

324-
if ($images) {
325-
$images = [$images];
324+
if (empty($images)) {
325+
return null;
326326
}
327327
} else {
328328
$images = Utils::sortByProviders($this->images);

src/Utils.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public static function sortByProviders(array $values)
126126
*/
127127
public static function unshiftValue(array &$values, $value)
128128
{
129-
$key = Utils::searchValue($values, $value['value']);
129+
$key = Utils::searchValue($values, $value['value'], true);
130130

131131
if ($key === false) {
132132
return array_unshift($values, $value);

tests/LineTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public function testOne()
77

88
$this->assertEquals($info->title, 'PHP Evolution');
99
$this->assertEquals($info->type, 'rich');
10-
$this->assertEquals($info->code, '<iframe src="https://line.do/embed/8oq/vertical" frameborder="0" allowTransparency="true" style="border:none;overflow:hidden;width:640px;height:640px;"></iframe>');
10+
$this->assertEquals($info->code, '<iframe src="https://line.do/embed/php-evolution/vertical" frameborder="0" allowTransparency="true" style="border:none;overflow:hidden;width:640px;height:640px;"></iframe>');
1111
$this->assertEquals($info->width, 640);
1212
$this->assertEquals($info->height, 640);
1313
$this->assertEquals($info->providerName, 'line');

tests/SoundcloudTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,18 @@ public function testThree()
3838
$this->assertEquals($info->providerUrl, 'https://soundcloud.com');
3939
}
4040

41+
public function testFour()
42+
{
43+
$info = Embed\Embed::create('https://soundcloud.com/ididthat-1/lowe-ct-cape-times-world-cup');
44+
45+
$this->assertEquals($info->title, "LOWE CT Cape Times - World Cup");
46+
$this->assertEquals($info->description, "If you did it. Show it on ididthat.net");
47+
$this->assertEquals($info->type, 'rich');
48+
$this->assertEquals($info->code, '<iframe width="100%" height="400" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?visual=true&url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F191904624&show_artwork=true"></iframe>');
49+
$this->assertEquals($info->providerName, 'SoundCloud');
50+
$this->assertEquals($info->providerUrl, 'https://soundcloud.com');
51+
}
52+
4153
public function testMobile()
4254
{
4355
$info = Embed\Embed::create('https://m.soundcloud.com/zedsdead/zeds-dead-twin-shadow-lost-you-feat-dangelo-lacy');

tests/SpreakerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ public function testOne()
99
$this->assertEquals($info->type, 'video');
1010
$this->assertEquals($info->code, '<iframe src="http://www.spreaker.com/embed/player/standard?autoplay=false&amp;episode_id=4535030" frameborder="0" allowTransparency="true" style="border:none;overflow:hidden;width:100%;height:131px;min-width:400px;"></iframe>');
1111
$this->assertEquals($info->providerName, 'Spreaker');
12-
$this->assertEquals($info->providerUrl, 'http://spreaker.com');
12+
$this->assertEquals($info->providerUrl, 'https://spreaker.com');
1313
}
1414
}

tests/YoutubeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ public function testOne()
66
$info = Embed\Embed::create('http://www.youtube.com/watch?v=eiHXASgRTcA');
77

88
$this->assertEquals($info->title, 'Noisy kittens waiting for dinner!');
9-
$this->assertEquals($info->description, 'Disclaimer - 7 week old fostered kittens waiting on their dinner being prepared. They had been ill with cat flu and were just starting to get their appetite ...');
9+
$this->assertEquals($info->description, '7 week old fostered kittens waiting on their dinner being prepared. They had been ill with cat flu and were just starting to get their appetite back. Because...');
1010
$this->assertEquals($info->imageWidth, 480);
1111
$this->assertEquals($info->imageHeight, 360);
1212
$this->assertEquals($info->type, 'video');

0 commit comments

Comments
 (0)