Skip to content

Commit

Permalink
Clean up tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gravitano committed Sep 10, 2014
1 parent 3c90196 commit 9024974
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions tests/OembedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ public function test_initialize()
public function test_get_info_from_a_specify_url()
{
$url = 'https://github.com/gravitano';
$this->embed->shouldReceive('get')->once()->with($url, '')->andReturn(array('url' => $url));
$info = $this->oembed->get($url);

$this->embed->shouldReceive('get')->once()->with($url, '')->andReturn(array('url' => $url));

$info = $this->oembed->get($url);

$this->assertTrue(is_array($info));
$this->assertArrayHasKey('url', $info);
Expand All @@ -34,8 +36,10 @@ public function test_get_info_from_a_specify_url()
public function test_get_info_from_a_specify_url_but_false_returned()
{
$url = 'foo';
$this->embed->shouldReceive('get')->once()->with($url, '')->andReturn(false);
$info = $this->oembed->get($url);

$this->embed->shouldReceive('get')->once()->with($url, '')->andReturn(false);

$info = $this->oembed->get($url);

$this->assertFalse($info);
}
Expand All @@ -44,8 +48,10 @@ public function test_get_info_from_a_specify_url_and_also_use_laravel_cache_mana
{

$url = 'https://www.youtube.com/watch?v=PP1xn5wHtxE';
$this->embed->shouldReceive('get')->once()->with($url, '')->andReturn(['url' => $url]);
$this->cache->shouldReceive('remember')->once()->andReturn(['url' => $url]);

$this->embed->shouldReceive('get')->once()->with($url, '')->andReturn(array('url' => $url));
$this->cache->shouldReceive('remember')->once()->andReturn(array('url' => $url));

$info = $this->oembed->cache($url);

$this->assertTrue(is_array($info));
Expand Down

0 comments on commit 9024974

Please sign in to comment.