From 565b63ac2193957d43d17c9c870a2321975e62f2 Mon Sep 17 00:00:00 2001
From: llaffont <llaffont@afi-sa.fr>
Date: Mon, 27 Jul 2015 15:51:46 +0200
Subject: [PATCH] dev #22209 search result feed

Add atom icon for search result
---
 .../ZendAfi/View/Helper/TagTitreEtNombreDeResultats.php  | 6 ++++++
 .../modules/opac/controllers/RechercheControllerTest.php | 9 ++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/library/ZendAfi/View/Helper/TagTitreEtNombreDeResultats.php b/library/ZendAfi/View/Helper/TagTitreEtNombreDeResultats.php
index b87cae9fa8c..8dd373d2dbb 100644
--- a/library/ZendAfi/View/Helper/TagTitreEtNombreDeResultats.php
+++ b/library/ZendAfi/View/Helper/TagTitreEtNombreDeResultats.php
@@ -30,6 +30,12 @@ class ZendAfi_View_Helper_TagTitreEtNombreDeResultats extends Zend_View_Helper_H
                                                $nombre_resultats);
 
     $html='<div class="info-recherche">';
+
+    $url_rss = $criteres_recherche->getUrlCriteresWithFacettes();
+    $url_rss['format'] = 'atom';
+    $html .= $this->view->tagRss($this->view->url($url_rss, null, true),
+                                 $this->view->_('Flux atom pour cette recherche'));
+
     $html.='<span>' . $plural_expression . '&nbsp;' . $expression_recherche . '</span>';
 
     return $html.='</div>';
diff --git a/tests/application/modules/opac/controllers/RechercheControllerTest.php b/tests/application/modules/opac/controllers/RechercheControllerTest.php
index 52cee2b9987..a744ee1d97c 100644
--- a/tests/application/modules/opac/controllers/RechercheControllerTest.php
+++ b/tests/application/modules/opac/controllers/RechercheControllerTest.php
@@ -620,7 +620,6 @@ class RechercheControllerViewNoticeClefAlphaTest extends RechercheControllerNoti
     $this->dispatch('recherche/viewnotice/clef/TESTINGALPHAKEY---101/expressionRecherche/Millenium', true);
   }
 
-
   /** @test */
   public function retourListeShouldLinkToRechercheSimpleWithHashTagIdNotice() {
     $this->assertXPathContentContains('//div/a[@class="retour"][contains(@href, "/recherche/simple/expressionRecherche/Millenium#345")]',
@@ -972,6 +971,14 @@ class RechercheControllerSimpleActionWithDefaultConfigTest extends RechercheCont
   }
 
 
+
+  /** @test */
+  public function pageShouldContainsLinkToAtomFormat() {
+    $this->assertXPath('//a[contains(@href, "/recherche/simple/expressionRecherche/pomme/tri/alpha_auteur/format/atom")]/img[contains(@src, "rss")]',
+                       $this->_response->getBody());
+  }
+
+
   /** @test */
   public function pommeShouldBePresentInRedirectedPageAsResultatInSession() {
     $this->assertXPathContentContains('//div', 'pomme');
-- 
GitLab