Skip to content

Commit

Permalink
Fix Gfycat
Browse files Browse the repository at this point in the history
  • Loading branch information
j0k3r committed May 25, 2015
1 parent 9dd2bc9 commit bb2f585
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/FeedBundle/Extractor/Gfycat.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ public function getContent()
return '';
}

if (!is_array($data) || empty($data) || !isset($data['gifUrl'])) {
if (!is_array($data) || empty($data) || !isset($data['gfyItem'])) {
return '';
}

return '<div><p><img src="'.$data['gifUrl'].'"></p></div>';
return '<div><h2>'.$data['gfyItem']['title'].'</h2><p><img src="'.$data['gfyItem']['gifUrl'].'"></p></div>';
}
}
4 changes: 2 additions & 2 deletions src/FeedBundle/Tests/Extractor/GfycatTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function testContent()
$response->expects($this->any())
->method('json')
->will($this->onConsecutiveCalls(
$this->returnValue(array('gifUrl' => 'http://0.0.0.0/img.gif')),
$this->returnValue(array('gfyItem' => array('title' => 'my title', 'gifUrl' => 'http://0.0.0.0/img.gif'))),
$this->returnValue(''),
$this->throwException(new RequestException())
));
Expand All @@ -88,7 +88,7 @@ public function testContent()
$gfycat->match('http://gfycat.com/SingleUntriedBudgie');

// consecutive calls
$this->assertEquals('<div><p><img src="http://0.0.0.0/img.gif"></p></div>', $gfycat->getContent());
$this->assertEquals('<div><h2>my title</h2><p><img src="http://0.0.0.0/img.gif"></p></div>', $gfycat->getContent());
// this one will got an empty array
$this->assertEmpty($gfycat->getContent());
// this one will catch an exception
Expand Down

0 comments on commit bb2f585

Please sign in to comment.