From 203b124f786186730e3e7c213c3d829c1f359724 Mon Sep 17 00:00:00 2001
From: Ghislain Loas <ghislo@sandbox.pergame.net>
Date: Thu, 29 Oct 2015 10:26:27 +0100
Subject: [PATCH] dev #30963 fix tests failures + add anchorsTarget script

---
 .../modules/opac/controllers/NoticeajaxController.php    | 3 +--
 library/Class/Exemplaire.php                             | 3 +--
 library/ZendAfi/View/Helper/Notice/Exemplaires.php       | 1 -
 .../controllers/NoticeAjaxControllerCdScriptTest.php     | 9 ++++++++-
 tests/library/Class/CommSigbTest.php                     | 3 ---
 tests/library/Class/WebService/SIGB/CdScriptTest.php     | 6 +++---
 6 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/application/modules/opac/controllers/NoticeajaxController.php b/application/modules/opac/controllers/NoticeajaxController.php
index c3201f48def..16af1df81de 100644
--- a/application/modules/opac/controllers/NoticeajaxController.php
+++ b/application/modules/opac/controllers/NoticeajaxController.php
@@ -120,8 +120,7 @@ class NoticeAjaxController extends Zend_Controller_Action {
       $notice->updateFacetsFromExemplaires()
              ->save();
 
-    $this->getResponse()->setBody($this->view->Notice_Exemplaires($exemplaires, $nb_notices_oeuvre, $display));
-
+    $this->_sendResponseWithScripts($this->view->Notice_Exemplaires($exemplaires, $nb_notices_oeuvre, $display));
   }
 
   public function exemplairesAction() {
diff --git a/library/Class/Exemplaire.php b/library/Class/Exemplaire.php
index 21be5d23d2d..f21c0f981cc 100644
--- a/library/Class/Exemplaire.php
+++ b/library/Class/Exemplaire.php
@@ -46,8 +46,7 @@ class Class_Exemplaire extends Storm_Model_Abstract {
                                           'genre' => null,
                                           'url' => null,
                                           'emplacement' => '',
-                                          'date_nouveaute' => '',
-                                          'cote' => ''];
+                                          'date_nouveaute' => ''];
 
   protected $_sigb_exemplaire;
 
diff --git a/library/ZendAfi/View/Helper/Notice/Exemplaires.php b/library/ZendAfi/View/Helper/Notice/Exemplaires.php
index 1372421bd89..dfa52ee83bc 100644
--- a/library/ZendAfi/View/Helper/Notice/Exemplaires.php
+++ b/library/ZendAfi/View/Helper/Notice/Exemplaires.php
@@ -23,7 +23,6 @@ class ZendAfi_View_Helper_Notice_Exemplaires extends ZendAfi_View_Helper_BaseHel
   protected $renderers = [];
 
   public function Notice_Exemplaires($exemplaires, $nb_notices_oeuvre=0, $aff="normal") {
-    xdebug_break();
     $preferences = Class_Profil::getCurrentProfil()->getCfgNoticeAsArray()['exemplaires'];
     if (!$exemplaires)
       return false;
diff --git a/tests/application/modules/opac/controllers/NoticeAjaxControllerCdScriptTest.php b/tests/application/modules/opac/controllers/NoticeAjaxControllerCdScriptTest.php
index 1c1a64d4a10..cbe54b8416e 100644
--- a/tests/application/modules/opac/controllers/NoticeAjaxControllerCdScriptTest.php
+++ b/tests/application/modules/opac/controllers/NoticeAjaxControllerCdScriptTest.php
@@ -49,13 +49,14 @@ class NoticeAjaxControllerCdScriptRecordTest extends AbstractControllerTestCase
                                          'id_notice' => 2,
                                          'id_int_bib' => '3',
                                          'id_bib' => '3',
+                                         'cote' => '',
                                          'zone995' => 'a:3:{i:0;a:2:{s:4:"code";s:1:"a";s:6:"valeur";s:10:"Le Kiosque";}i:1;a:2:{s:4:"code";s:1:"b";s:6:"valeur";s:3:"kio";}i:2;a:2:{s:4:"code";s:1:"f";s:6:"valeur";s:3:"319";}}']);
     $this->_record_le_kiosque = $this->fixture('Class_Notice',
                                                ['id' => 2,
                                                'exemplaires' => [$this->_item_le_kiosque]]);
 
     $this->_service = Class_WebService_SIGB_CdScript::getService(['server_url' => 'www.jumel39.fr/docnum.php',
-                                                                  'bib' => 2]);
+                                                                  'remote_library_id' => 2]);
     $this->_service->setTimeSource(new TimeSourceForTest('2015-10-28 09:00:00'));
 
     $this->dispatch('/opac/noticeajax/exemplaires/id_notice/2', true);
@@ -73,5 +74,11 @@ class NoticeAjaxControllerCdScriptRecordTest extends AbstractControllerTestCase
   public function libraryLabelShouldBeLeKiosqueLibrary() {
     $this->assertXPathContentContains('//table//td', 'Le kiosque library');
   }
+
+
+  /** @test */
+  public function scriptTargetBlankShouldBePresent() {
+    $this->assertXpathContentContains('//script', 'setupAnchorsTarget');
+  }
 }
 ?>
\ No newline at end of file
diff --git a/tests/library/Class/CommSigbTest.php b/tests/library/Class/CommSigbTest.php
index 7a02654ea53..b6c2eb74746 100644
--- a/tests/library/Class/CommSigbTest.php
+++ b/tests/library/Class/CommSigbTest.php
@@ -536,8 +536,6 @@ class CommSigbMicrobibTest extends CommSigbTestCase {
 
 
 
-
-
 class CommSigbBiblixNetTest extends CommSigbTestCase {
   public function setUp() {
     parent::setUp();
@@ -562,7 +560,6 @@ class CommSigbBiblixNetTest extends CommSigbTestCase {
 
 
 
-
 class CommSigbDynixTest extends CommSigbTestCase {
   public function setUp() {
     parent::setUp();
diff --git a/tests/library/Class/WebService/SIGB/CdScriptTest.php b/tests/library/Class/WebService/SIGB/CdScriptTest.php
index ccbfcbb60ec..516b6be9373 100644
--- a/tests/library/Class/WebService/SIGB/CdScriptTest.php
+++ b/tests/library/Class/WebService/SIGB/CdScriptTest.php
@@ -26,7 +26,7 @@ abstract class CdScriptTestCase extends Storm_Test_ModelTestCase {
   public function setUp() {
     parent::setUp();
     $this->_service = Class_WebService_SIGB_CdScript::getService(['server_url' => 'www.jumel39.fr/docnum.php',
-                                                                  'bib' => 2]);
+                                                                  'remote_library_id' => 2]);
     $this->_service->setTimeSource(new TimeSourceForTest('2015-10-28 09:00:00'));
   }
 }
@@ -96,8 +96,8 @@ class CdScriptServiceTest extends CdScriptTestCase {
 
 
   /** @test */
-  public function leKiosqueItemDispoShouldBeJumelLink() {
-    $this->assertEquals('www.jumel39.fr/docnum.php?bib=2&res=kio&lien=456789&time=1446019200&user=654987:Le Pollux:Paul:2002-12-14:empty@email:2015-12-14', $this->_sigb_le_kiosque->getDisponibilite());
+  public function leKiosqueItemUrlShouldBeJumelLink() {
+    $this->assertEquals('www.jumel39.fr/docnum.php?bib=2&res=kio&lien=456789&time=1446019200&user=654987:Le Pollux:Paul:2002-12-14:empty@email:2015-12-14', $this->_le_kiosque->getUrl());
   }
 
 
-- 
GitLab