diff --git a/VERSIONS_HOTLINE/29412 b/VERSIONS_HOTLINE/29412 new file mode 100644 index 0000000000000000000000000000000000000000..dae89ac67ecdb9e12195b9ce4f328fd5873f5db7 --- /dev/null +++ b/VERSIONS_HOTLINE/29412 @@ -0,0 +1 @@ + - ticket #29412 : correction du vignettage des articles dans le résultat de recherche. \ No newline at end of file diff --git a/application/modules/admin/controllers/CmsController.php b/application/modules/admin/controllers/CmsController.php index 0fd612d0efa6d9d623ea5f1fa203e5a9341a6de4..66d2bcc98328ce489415244c46aa825d4eac5c5a 100644 --- a/application/modules/admin/controllers/CmsController.php +++ b/application/modules/admin/controllers/CmsController.php @@ -48,6 +48,8 @@ class Admin_CmsController extends ZendAfi_Controller_Action { protected function _postEditAction($article) { $article->index(); + if($record = $article->getNotice()) + (new Class_WebService_Vignette())->updateUrlsFromCacheServer($record); } diff --git a/tests/application/modules/admin/controllers/CmsControllerTest.php b/tests/application/modules/admin/controllers/CmsControllerTest.php index 30811d21ce7d3cb6c74f4282a22a6f2f3a1fbe1c..6cf15a3ce1fbc93856fe56e5ee3edfca9a1b3092 100644 --- a/tests/application/modules/admin/controllers/CmsControllerTest.php +++ b/tests/application/modules/admin/controllers/CmsControllerTest.php @@ -844,6 +844,29 @@ class CmsControllerArticleConcertEditActionPostTest extends CmsControllerWithPer public function setUp() { parent::setUp(); + $filesystem = new Storm_FileSystem_Volatile(); + $thumbnail_paths = PATH_TEMP .'vignettes_titre/'; + $filesystem + ->mkdir($thumbnail_paths) + ->cd($thumbnail_paths); + + Class_WebService_Vignette::setFileSystem($filesystem); + + $image = Storm_Test_ObjectWrapper::mock(); + Class_WebService_Thumbnail_Provider_Article::setDefaultImageFactory( + Storm_Test_ObjectWrapper::mock() + ->whenCalled('newImage') + ->answers($image)); + + $image + ->whenCalled('thumbnailImage') + ->with(160, 220, true, true) + ->answers(null) + ->whenCalled('writeImage') + ->with(PATH_TEMP . 'vignettes_titre/ERIKTRUFFAZLADYLANDQUARTETENCONCERT-4-TOM----8.jpg') + ->answers(null) + ->beStrict(); + Class_Notice::beVolatile(); Class_NoticeDomain::beVolatile(); Class_IntBib::beVolatile(); @@ -892,6 +915,13 @@ class CmsControllerArticleConcertEditActionPostTest extends CmsControllerWithPer } + public function tearDown() { + Class_WebService_Vignette::setFileSystem(null); + Class_WebService_Thumbnail_Provider_Article::setDefaultImageFactory(null); + parent::tearDown(); + } + + /** @test */ public function erikTruffazShouldBeIndexed() { $this->assertNotNull(Class_Notice::findFirstBy(['alpha_titre' =>'ERIK TRUFFAZ LADYLAND QUARTET EN CONCERT'])); @@ -1019,6 +1049,12 @@ class CmsControllerArticleConcertEditActionPostTest extends CmsControllerWithPer public function flashMessengerShouldNotContainsPopup() { $this->assertNotFlashMessengerPopup(); } + + + /** @test */ + public function articleRecordThumbnailShouldBeSet() { + $this->assertContains('temp/vignettes_titre/ERIKTRUFFAZLADYLANDQUARTETENCONCERT-4-TOM----8.jpg', Class_Article::find(4)->getNotice()->getUrlVignette()); + } } diff --git a/tests/application/modules/opac/controllers/RechercheControllerTest.php b/tests/application/modules/opac/controllers/RechercheControllerTest.php index f93bbc811f36d402c7382ac8cd49cee0ef120fe6..fe1139bb90839cac20e22d9cd4b762abc3318e93 100644 --- a/tests/application/modules/opac/controllers/RechercheControllerTest.php +++ b/tests/application/modules/opac/controllers/RechercheControllerTest.php @@ -569,15 +569,11 @@ class RechercheControllerVignetteTest extends RechercheControllerNoticeTestCase class RechercheControllerVignetteEmptyTest extends AbstractControllerTestCase { - public function tearDown() { - Storm_Model_Loader::defaultToDb(); - } + protected $_storm_default_to_volatile = true; public function setUp() { parent::setUp(); - Storm_Model_Loader::defaultToVolatile(); - $article = $this->fixture('Class_Article', ['id' => 123, 'titre' => 'An article with img', @@ -586,12 +582,11 @@ class RechercheControllerVignetteEmptyTest extends AbstractControllerTestCase { $this->dispatch('recherche/vignette/id_notice/1', true); } + /** @test */ public function responseShouldRedirectToVignetteUrl() { $this->assertContains('/temp/vignettes_titre/notice_1.png', $this->getResponseLocation()); - - } }