Skip to content

Commit

Permalink
bug on get the image in soundcloud fixes #52
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarotero committed Mar 13, 2015
1 parent ea5d7d1 commit a06a333
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Adapters/Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,8 @@ public function getImage()
if ($this->config['getBiggerImage']) {
$images = $this->images;

if ($images) {
$images = [$images];
if (empty($images)) {
return null;
}
} else {
$images = Utils::sortByProviders($this->images);
Expand Down
2 changes: 1 addition & 1 deletion src/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public static function sortByProviders(array $values)
*/
public static function unshiftValue(array &$values, $value)
{
$key = Utils::searchValue($values, $value['value']);
$key = Utils::searchValue($values, $value['value'], true);

if ($key === false) {
return array_unshift($values, $value);
Expand Down
2 changes: 1 addition & 1 deletion tests/LineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public function testOne()

$this->assertEquals($info->title, 'PHP Evolution');
$this->assertEquals($info->type, 'rich');
$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>');
$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>');
$this->assertEquals($info->width, 640);
$this->assertEquals($info->height, 640);
$this->assertEquals($info->providerName, 'line');
Expand Down
12 changes: 12 additions & 0 deletions tests/SoundcloudTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@ public function testThree()
$this->assertEquals($info->providerUrl, 'https://soundcloud.com');
}

public function testFour()
{
$info = Embed\Embed::create('https://soundcloud.com/ididthat-1/lowe-ct-cape-times-world-cup');

$this->assertEquals($info->title, "LOWE CT Cape Times - World Cup");
$this->assertEquals($info->description, "If you did it. Show it on ididthat.net");
$this->assertEquals($info->type, 'rich');
$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>');
$this->assertEquals($info->providerName, 'SoundCloud');
$this->assertEquals($info->providerUrl, 'https://soundcloud.com');
}

public function testMobile()
{
$info = Embed\Embed::create('https://m.soundcloud.com/zedsdead/zeds-dead-twin-shadow-lost-you-feat-dangelo-lacy');
Expand Down
2 changes: 1 addition & 1 deletion tests/SpreakerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ public function testOne()
$this->assertEquals($info->type, 'video');
$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>');
$this->assertEquals($info->providerName, 'Spreaker');
$this->assertEquals($info->providerUrl, 'http://spreaker.com');
$this->assertEquals($info->providerUrl, 'https://spreaker.com');
}
}
2 changes: 1 addition & 1 deletion tests/YoutubeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public function testOne()
$info = Embed\Embed::create('http://www.youtube.com/watch?v=eiHXASgRTcA');

$this->assertEquals($info->title, 'Noisy kittens waiting for dinner!');
$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 ...');
$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...');
$this->assertEquals($info->imageWidth, 480);
$this->assertEquals($info->imageHeight, 360);
$this->assertEquals($info->type, 'video');
Expand Down

0 comments on commit a06a333

Please sign in to comment.