diff --git a/VERSIONS_HOTLINE/133576 b/VERSIONS_HOTLINE/133576 new file mode 100644 index 0000000000000000000000000000000000000000..1692110ab848c5a7aeaa19defaf32564ea7a9e1b --- /dev/null +++ b/VERSIONS_HOTLINE/133576 @@ -0,0 +1 @@ + - ticket #133576 : Enrichissement : lorsqu'un nouvel article Wikipedia est défini pour un auteur, l'image est toujours remise à zéro. \ No newline at end of file diff --git a/library/Class/CodifAuteur/Description.php b/library/Class/CodifAuteur/Description.php index 65934b7d715e93088d12321c6c122160c129596c..72da3f015d22d9f170b0e258db22e53ac3ab8f7f 100644 --- a/library/Class/CodifAuteur/Description.php +++ b/library/Class/CodifAuteur/Description.php @@ -249,8 +249,8 @@ class Class_CodifAuteur_Description { 'youtube_channel_id' => '', 'ark' => '', 'isni' => '']); - if ($bio->getvignette()) - $author_attribs['thumbnail_url'] = $bio->getvignette(); + + $author_attribs['thumbnail_url'] = $bio->getvignette(); $this->_author ->updateAttributes($author_attribs) diff --git a/tests/scenarios/AuthorPage/AuthorPageTest.php b/tests/scenarios/AuthorPage/AuthorPageTest.php index 2b22ef976ccbfc72005bd1c4e75b83c31b069db6..967b3062c72dc859e35e402552fa1f5e301eadad 100644 --- a/tests/scenarios/AuthorPage/AuthorPageTest.php +++ b/tests/scenarios/AuthorPage/AuthorPageTest.php @@ -467,6 +467,48 @@ class AuthorPageViewByIdTest extends AuthorPageTestCase { + +class AuthorPageViewByIdWithNoImageTest extends AuthorPageTestCase { + public function setUp() { + parent::setUp(); + Class_WebService_AllServices::setHttpClient($this->_http_client = $this->mock()); + + $this->_http_client + ->whenCalled('open_url') + ->with('http://cache.org?auteur=Victor+Hugo&clef_oeuvre=GAVROCHE--HUGOV-5&language=fr' + .'&src=' . Class_WebService_AllServices::createSecurityKey() + .'&api=2.0&action=8') + ->answers(json_encode(['statut_recherche' => 2, + 'erreur' => '', + 'source' => 'Wikipedia', + 'url_source' => 'https://fr.wikipedia.org/wiki/Victor_Hugo', + 'biographie' => '1980 : <i>Les Misérables</i> (adaptation d\'Alain Boublil et Claude-Michel Schönberg) pour Robert Hossein, est devenue ....avec Marcus %s \Mill bizarre', + 'vignette' => '', + 'image' => '', + 'wikidata_id' => 'Q8298', + 'youtube_channel_id' => 'UC1l7wYrva1qCH-wgqcHaaRg', + 'isni' => '0000 0000 7839 1751', + 'ark' => 'ark:/12148/cb13971020f', + 'biography_disabled' => 0])) + ->beStrict(); + + Class_CodifAuteur::find(2408)->setThumbnailUrl('https://wiki.org/wrong-image.png'); + + $this->dispatch('noticeajax/author/id/2408'); + } + + + /** @test */ + public function authorThumbnailUrlShouldBeResetToEmptyString() { + $this->assertEquals('', + (new Class_CodifAuteur_Description(Class_CodifAuteur::find(2408))) + ->getThumbnailUrl()); + } +} + + + + class AuthorPagePhoneTest extends AuthorPageTestCase { public function setUp() { parent::setUp();