Skip to content
Snippets Groups Projects
Commit 7a55992c authored by llaffont's avatar llaffont
Browse files

Correction erreur génération vignette si notice inexistante

parent 5b99401e
No related merge requests found
......@@ -36,7 +36,9 @@ class Class_WebService_Vignette {
//------------------------------------------------------------------------------------------------------
public function getImage($id_notice, $cache=false) {
// Chercher dans le cache
$notice = Class_Notice::find($id_notice);
if (!$notice = Class_Notice::find($id_notice))
return URL_ADMIN_IMG.'supports/vignette_vide.gif';
return $notice->withUrlVignetteDo(
function($notice, $url_vignette, $url_image) use ($cache) {
return $this->fetchAndSaveImage($notice, $url_vignette, $url_image, $cache);
......
......@@ -707,4 +707,14 @@ class RechercheControllerRebondTest extends AbstractControllerTestCase {
}
}
class RechercheControllerVignetteUnknownNoticeTest extends AbstractControllerTestCase {
/** @test */
public function responseShouldRedirectToVignetteVideDotGif() {
$this->dispatch('/recherche/vignette');
$this->assertRedirectTo('http://localhost'.BASE_URL.'/public/admin/images/supports/vignette_vide.gif');
}
}
?>
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment