Skip to content

Commit

Permalink
fixed outdated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarotero committed May 9, 2015
1 parent 3db7310 commit a30a758
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 27 deletions.
33 changes: 9 additions & 24 deletions tests/ImagesBlacklistTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,61 +3,46 @@ class ImagesBlacklistTest extends PHPUnit_Framework_TestCase
{
public function testPlainText()
{
$info = Embed\Embed::create('http://www.lopinion.fr/24-mars-2015/cartes-chance-sont-epuisees-22609', [
$info = Embed\Embed::create('https://github.com/oscarotero/Embed', [
'adapter' => [
'config' => [
'imagesBlacklist' => [
'http://www.lopinion.fr/sites/nb.com/files/2015/01/logo-o-default_0.png?p',
'https://avatars1.githubusercontent.com/u/377873?v=3&s=400',
],
],
],
'providers' => [
'html' => [
'maxImages' => 0,
],
]
]);

$this->assertNull($info->image);
$this->assertEquals('https://assets-cdn.github.com/assets/spinners/octocat-spinner-32-e513294efa576953719e4e2de888dd9cf929b7d62ed8d05f25e731d02452ab6c.gif', $info->image);
}

public function testPlainUrlMatch()
{
$info = Embed\Embed::create('http://www.lopinion.fr/24-mars-2015/cartes-chance-sont-epuisees-22609', [
$info = Embed\Embed::create('https://github.com/oscarotero/Embed', [
'adapter' => [
'config' => [
'imagesBlacklist' => [
'*/logo-o-default_0.png*',
'*.githubusercontent.com*',
],
],
],
'providers' => [
'html' => [
'maxImages' => 0,
],
]
]);

$this->assertNull($info->image);
$this->assertEquals('https://assets-cdn.github.com/assets/spinners/octocat-spinner-32-e513294efa576953719e4e2de888dd9cf929b7d62ed8d05f25e731d02452ab6c.gif', $info->image);
}

public function testAuthorizedImage()
{
$info = Embed\Embed::create('http://www.lopinion.fr/24-mars-2015/jeunes-restent-angle-mort-politiques-publiques-22607', [
$info = Embed\Embed::create('https://github.com/oscarotero/Embed', [
'adapter' => [
'config' => [
'imagesBlacklist' => [
'*/logo-o-default_0.png*',
'*/octocat-spinner-*',
],
],
],
'providers' => [
'html' => [
'maxImages' => 0,
],
]
]);

$this->assertNotNull($info->image);
$this->assertEquals('https://avatars1.githubusercontent.com/u/377873?v=3&s=400', $info->image);
}
}
2 changes: 1 addition & 1 deletion tests/RedirectionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public function testGoogleTranslate()
public function testRdio()
{
$info1 = Embed\Embed::create('http://rd.io/x/Q1IjXC8s');
$info2 = Embed\Embed::create('https://www.rdio.com/artist/Soundgarden/album/Superunknown/');
$info2 = Embed\Embed::create('https://www.rdio.com/artist/Soundgarden/album/Superunknown/?utm_campaign=share&utm_medium=Album&utm_source=13&utm_content=224371');
$this->assertEquals($info1->url, $info2->url);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/SoundcloudTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function testTwo()
$info = Embed\Embed::create('https://soundcloud.com/bruceneilmusic');

$this->assertEquals($info->title, "Bruce Neil");
$this->assertEquals($info->description, "Bruce Neil from Wokingham is a self-taught singer/songwriter with a folk and blues sound, producing songs that tell stories about people. Recently having success winning a BBC Introducing competition and achieving air play nationally. He takes his musical inspiration and guitar-playing style from the likes of Passenger Mick Flannery and Tommy Emmanuel.");
$this->assertEquals($info->description, "Bruce Neil from Wokingham is a singer/songwriter with a folk inspired sound, producing songs with heartfelt depth and lyrics that captivate the listener, taking them on an insightful and thought-provoking journey. As a winner of BBC Introducing, resulting in air play nationally, he has recently achieved widespread public attention following the video release of his percussive folk rendition of Guns N’ Roses track Paradise City. Not only did this go viral on social media, it was endorsed by the band themselves and has achieved recognition and air play from several US radio stations. He takes his musical inspiration and guitar-playing style from the likes of Passenger and Mick Flannery.");
$this->assertEquals($info->type, 'rich');
$this->assertEquals($info->code, '<iframe width="100%" height="450" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?visual=true&url=http%3A%2F%2Fapi.soundcloud.com%2Fusers%2F6538603&show_artwork=true"></iframe>');
$this->assertEquals($info->providerName, 'SoundCloud');
Expand Down
2 changes: 1 addition & 1 deletion tests/TwitterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ public function testOmitScript()
],
]);

$this->assertEquals($info->code, '<blockquote class="twitter-tweet"><p>RT <a href="https://twitter.com/PabloHerreros">@PabloHerreros</a> Pepephone rompe la baraja - <a href="http://t.co/mFn7mcB1vy">http://t.co/mFn7mcB1vy</a></p>&mdash; pepephone (@pepephone) <a href="https://twitter.com/pepephone/status/436461658601713664">February 20, 2014</a></blockquote>'."\n");
$this->assertEquals($info->code, '<blockquote class="twitter-tweet"><p lang="es" dir="ltr">RT <a href="https://twitter.com/PabloHerreros">@PabloHerreros</a> Pepephone rompe la baraja - <a href="http://t.co/mFn7mcB1vy">http://t.co/mFn7mcB1vy</a></p>&mdash; pepephone (@pepephone) <a href="https://twitter.com/pepephone/status/436461658601713664">February 20, 2014</a></blockquote>'."\n");
}
}

0 comments on commit a30a758

Please sign in to comment.