From 8b1cf862934c5b600664baaf170333e39764bd3b Mon Sep 17 00:00:00 2001
From: lbrun <leo@sandbox.pergame.net>
Date: Thu, 15 Oct 2015 16:12:16 +0200
Subject: [PATCH] hotline#26494 : fix tests

---
 application/modules/opac/controllers/BibController.php     | 4 +++-
 .../modules/opac/controllers/BibControllerTest.php         | 7 +------
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/application/modules/opac/controllers/BibController.php b/application/modules/opac/controllers/BibController.php
index 97c0a5f3aef..b444b8d60f1 100644
--- a/application/modules/opac/controllers/BibController.php
+++ b/application/modules/opac/controllers/BibController.php
@@ -99,7 +99,9 @@ class BibController extends ZendAfi_Controller_Action {
       if(false === strpos($this->_getReferer(), '/recherche/simple'))
         return $this->_redirectToReferer();
 
-      return $this->_redirectToRefererWithNewParams(['bib_select' => implode(',',$this->view->id_bibs_session)]);
+      $bib_select = implode(',',$this->view->id_bibs_session);
+      return $this->_redirectToRefererWithNewParams(['bib_select' => ($bib_select === ''
+                                                                      ? null : $bib_select)]);
     }
   }
 
diff --git a/tests/application/modules/opac/controllers/BibControllerTest.php b/tests/application/modules/opac/controllers/BibControllerTest.php
index 3fd563ba358..8d62fa98f2e 100644
--- a/tests/application/modules/opac/controllers/BibControllerTest.php
+++ b/tests/application/modules/opac/controllers/BibControllerTest.php
@@ -506,7 +506,7 @@ class BibControllerBibSelectionPostDispatchTest extends BibControllerSelectionTe
 class BibControllerBibSelectionUnselectPostDispatch extends BibControllerSelectionTestCase {
   public function setUp() {
     parent::setUp();
-    $_SERVER['HTTP_REFERER'] = 'http://mybokeh.org';
+    $_SERVER['HTTP_REFERER'] = 'http://mybokeh.org/recherche/simple/expressionRecherche/pomme/bib_select/2';
 
     $this->postDispatch('bib/selection', ['update_bib_select' => 1]);
   }
@@ -520,11 +520,6 @@ class BibControllerBibSelectionUnselectPostDispatch extends BibControllerSelecti
   public function sessionShouldNotContainsCasablancaAndCairo() {
     $this->assertEquals([] , $this->_session->id_bibs);
   }
-
-  /** @test */
-  public function shouldRedirectToRefererWithNewParams() {
-    $this->assertRedirectTo('http://mybokeh.org');
-  }
 }
 
 
-- 
GitLab