From b491a845561e7509e4c1e124a22510616298e9bd Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT <hdlaurent@afi-sa.fr> Date: Fri, 28 Mar 2025 14:17:07 +0100 Subject: [PATCH] hotline#214576 : bookmarkedsearches : emails notifications are reenabled --- VERSIONS_HOTLINE/214576 | 1 + cosmogramme/php/integre_traite_main.php | 2 +- .../Integration/PhaseBookmarkedSearches.php | 6 ++ .../PhaseBookmarkedSearchesTest.php | 56 +++++++++++++++++++ tests/scenarios/bookmarks/SearchTest.php | 4 +- 5 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 VERSIONS_HOTLINE/214576 create mode 100644 tests/library/Class/Cosmogramme/Integration/PhaseBookmarkedSearchesTest.php diff --git a/VERSIONS_HOTLINE/214576 b/VERSIONS_HOTLINE/214576 new file mode 100644 index 00000000000..c7a9343d987 --- /dev/null +++ b/VERSIONS_HOTLINE/214576 @@ -0,0 +1 @@ + - correctif #214576 : recherches favorites: Les notifications par mail des recherches favorites sont à nouveau actives \ No newline at end of file diff --git a/cosmogramme/php/integre_traite_main.php b/cosmogramme/php/integre_traite_main.php index 8b3a28b0904..154b7bd061c 100644 --- a/cosmogramme/php/integre_traite_main.php +++ b/cosmogramme/php/integre_traite_main.php @@ -315,7 +315,7 @@ if (12 == $phase || 13 == $phase) { // ---------------------------------------------------------------- // DSI - Notifications des nouveautés // ---------------------------------------------------------------- -if ($phase >= 14 || $phase <= 19) { +if (14 == $phase) { startIntegrationPhase('BookmarkedSearches'); $phase = 20; } diff --git a/library/Class/Cosmogramme/Integration/PhaseBookmarkedSearches.php b/library/Class/Cosmogramme/Integration/PhaseBookmarkedSearches.php index 99c84e80ac9..5a416f83b83 100644 --- a/library/Class/Cosmogramme/Integration/PhaseBookmarkedSearches.php +++ b/library/Class/Cosmogramme/Integration/PhaseBookmarkedSearches.php @@ -31,6 +31,12 @@ class Class_Cosmogramme_Integration_PhaseBookmarkedSearches } + protected function _previousPhaseIds() + { + return [14]; + } + + protected function _init($phase) { $phase->resetDatas(); } diff --git a/tests/library/Class/Cosmogramme/Integration/PhaseBookmarkedSearchesTest.php b/tests/library/Class/Cosmogramme/Integration/PhaseBookmarkedSearchesTest.php new file mode 100644 index 00000000000..189e2e793ab --- /dev/null +++ b/tests/library/Class/Cosmogramme/Integration/PhaseBookmarkedSearchesTest.php @@ -0,0 +1,56 @@ +<?php +/** + * Copyright (c) 2012-2021, Agence Française Informatique (AFI). All rights reserved. + * + * BOKEH is free software; you can redistribute it and/or modify + * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by + * the Free Software Foundation. + * + * There are special exceptions to the terms and conditions of the AGPL as it + * is applied to this software (see README file). + * + * BOKEH is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE + * along with BOKEH; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +class PhaseBookmarkedSearchesTest + extends Class_Cosmogramme_Integration_PhaseTestCase +{ + protected function _getPreviousPhase() + { + return (new Class_Cosmogramme_Integration_Phase(14))->beCron(); + } + + + public function setUp(): void + { + parent::setUp(); + Zend_Registry::set('sql', + $this->mock() + ->whenCalled('query') + ->with('ALTER TABLE `notices` ADD FULLTEXT KEY IF NOT EXISTS `mots_notice` (`titres`, `auteurs`, `editeur`, `collection`, `matieres`, `dewey`, `other_terms`, `facets`)') + ->answers([])); + + $this->_phase = $this->_buildPhase('BookmarkedSearches')->run(); + } + + public function tearDown(): void + { + Zend_Registry::set('sql',null); + parent::tearDown(); + } + + + /** @test */ + public function logShouldContainsNotificationNouveautes() + { + $this->assertLogContains('Notification des nouveautés dans les recherches favorites'); + } +} diff --git a/tests/scenarios/bookmarks/SearchTest.php b/tests/scenarios/bookmarks/SearchTest.php index 8fa982edd9d..17b2741fe36 100644 --- a/tests/scenarios/bookmarks/SearchTest.php +++ b/tests/scenarios/bookmarks/SearchTest.php @@ -454,7 +454,7 @@ class Bookmarks_SearchCosmogrammePhaseTest $_mail_transport; protected function _getPreviousPhase() { - return (new Class_Cosmogramme_Integration_Phase(17)) + return (new Class_Cosmogramme_Integration_Phase(14)) ->beCron(); } @@ -626,7 +626,7 @@ class Bookmarks_SearchMailWithArticlePhaseTest $_mail; protected function _getPreviousPhase() { - return (new Class_Cosmogramme_Integration_Phase(17)) + return (new Class_Cosmogramme_Integration_Phase(14)) ->beCron(); } -- GitLab