Skip to content
Snippets Groups Projects
Commit 6148df4e authored by Henri-Damien LAURENT's avatar Henri-Damien LAURENT Committed by Patrick Barroca
Browse files

hotline#113974 : Moderation : error displaying page when external thumbnail...

hotline#113974 : Moderation : error displaying page when external thumbnail ressource is unavailable
parent 1fe6aa0a
Branches
Tags
2 merge requests!3589Hotline,!3575hotline#113974 : Moderation : error displaying page when external thumbnail…
Pipeline #10736 passed with stage
in 45 minutes and 37 seconds
- ticket #113974 : Module modération : Erreur 500 quand il n'est pas possible de télécharger la vignette d'une ressource numérique
\ No newline at end of file
......@@ -38,8 +38,10 @@ class Class_Notice_Thumbnail_ProviderAlbum
if (!$url = $album->getPoster())
return null;
if ((new Class_WebService_BibNumerique_Vignette())->downloadPoster($album))
return $album->getVignettePath();
try {
if ((new Class_WebService_BibNumerique_Vignette())->downloadPoster($album))
return $album->getVignettePath();
} catch (Exception $e) {}
return null;
}
......
......@@ -730,6 +730,87 @@ class ModoControllerDeleteAvisCmsTest extends Admin_AbstractControllerTestCase {
class ModoControllerAvisNoticeHTTPErrorOnGetVignetteTest extends Admin_AbstractControllerTestCase {
protected $_storm_default_to_volatile = true,
$_http_client;
public function setup() {
parent::setup();
Class_AdminVar::set('AVIS_MIN_SAISIE', 1);
Class_AdminVar::set('AVIS_MAX_SAISIE', 100);
$this->fixture('Class_AvisNotice', ['id' => 622,
'id_notice' => 10,
'entete' => 'Orphan Test',
'note'=> 2,
'id_user' => null,
'flags' => 1,
'avis' => 'Un bon livre !',
'statut' => 0,
'abon_ou_bib' => 1,
'source_author' => null]);
$this->fixture('Class_Profil',
['id' => 1, 'libelle' => 'default profil'])
->beCurrentProfil();
$this->fixture('Class_Notice',
['id'=> 10,
'titre_principal' => 'Le photographe',
'auteur_principal' => 'Guibert',
'isbn' => '3222222',
'ean' => '1111111',
'url_origine' => 'http://image.org/test.png',
'clef_alpha' => 'LEPHOOGRAPHE--GUIBERT---2004-1',
'type_doc' => Class_TypeDoc::ARTEVOD]);
$this->fixture('Class_Exemplaire',
['id'=> 10,
'id_notice'=> 10,
'type' => Class_TypeDoc::ARTEVOD]);
$this->fixture('Class_Album',
['id' => 42,
'titre' => 'Le Photographe',
'fichier' => 'potter.jpg',
'notice_id' => 10,
'type_doc_id' => Class_TypeDoc::ARTEVOD])
->addPosterURI('http://cache.org/test/image.jpg');
$this->_http_client = $this->mock()
->whenCalled('getResponse')
->willDo( function ()
{
throw new \Exception('Unable to connect to webservice');
});
Class_WebService_Vignette::setDefaultHttpClient($this->_http_client);
$this->dispatch('admin/modo/avisnotice', true);
}
public function tearDown() {
Class_WebService_Vignette::setDefaultHttpClient(null);
parent::tearDown();
}
/** @test */
public function oneExceptionShouldHaveBeenRaised() {
$this->assertTrue($this->_http_client->methodHasBeenCalled('getResponse'));
}
/** @test */
public function vignetteNoticeShouldBeDefaultImage() {
$this->assertXPathContentContains('//img/@src','/public/admin/images/supports/artevod.png',$this->_response->getBody());
}
}
class ModoControllerAvisnoticeActionTest extends Admin_AbstractControllerTestCase {
protected $_storm_default_to_volatile = true;
......@@ -845,7 +926,7 @@ class ModoControllerAllReviewsPageActionTest extends ModoControllerIndexActionTe
/** @test **/
public function page3ShouldNotConstainsTheLastReviewSaved139() {
$this->dispatch('admin/modo/avisnotice/status/1/page/3/active_tab/1', true);
$this->dispatch('admin/modo/avisnotice/status/1/page/3/active_tab/1', true);
$this->assertNotXpathContentContains('//div[@class="critique"]//div[@class="contenu_critique"]//a[contains(@href, "blog/viewavis")]', '139');
}
......
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