From f95e9d3672963f20914bd0d3a3128c624e2ce9e2 Mon Sep 17 00:00:00 2001
From: gloas <gloas@afi-sa.fr>
Date: Mon, 18 Jun 2018 16:56:36 +0200
Subject: [PATCH] dev #75882 : fix failures

---
 library/Class/WebService/Lastfm.php                       | 3 +++
 .../Controller/Plugin/Manager/BookmarkedSearches.php      | 8 ++++----
 tests/application/modules/AbstractControllerTestCase.php  | 1 +
 tests/scenarios/AuthorBrowser/AuthorBrowserTest.php       | 2 ++
 tests/scenarios/Pcdm4Browser/Pcdm4BrowserTest.php         | 3 +++
 5 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/library/Class/WebService/Lastfm.php b/library/Class/WebService/Lastfm.php
index 2134108116c..930427fecb4 100644
--- a/library/Class/WebService/Lastfm.php
+++ b/library/Class/WebService/Lastfm.php
@@ -196,6 +196,9 @@ class Class_WebService_Lastfm  extends Class_WebService_Abstract {
 
     $photos = [];
     foreach($elements as $element) {
+      if (!$element)
+        continue;
+
       $url = $element->getAttribute('src');
 
       $photos []= ['thumb' => $url,
diff --git a/library/ZendAfi/Controller/Plugin/Manager/BookmarkedSearches.php b/library/ZendAfi/Controller/Plugin/Manager/BookmarkedSearches.php
index 0549cfdf334..5c09f9d673e 100644
--- a/library/ZendAfi/Controller/Plugin/Manager/BookmarkedSearches.php
+++ b/library/ZendAfi/Controller/Plugin/Manager/BookmarkedSearches.php
@@ -51,13 +51,13 @@ class ZendAfi_Controller_Plugin_Manager_BookmarkedSearches extends ZendAfi_Contr
 
   protected function _checkBookmarkedSearchRequest() {
     if(!$search = $this->_findModel()) {
-      $this->_helper->_notify($this->_('La recherche demandée est introuvable.'));
+      $this->_helper->notify($this->_('La recherche demandée est introuvable.'));
       $this->_redirectToIndex();
       return;
     }
 
     if(!$search->belongsTo($this->_user)) {
-      $this->_helper->_notify($this->_('Cette recherche ne vous appartient pas.'));
+      $this->_helper->notify($this->_('Cette recherche ne vous appartient pas.'));
       $this->_redirectToIndex();
       return;
     }
@@ -82,7 +82,7 @@ class ZendAfi_Controller_Plugin_Manager_BookmarkedSearches extends ZendAfi_Contr
 
     $search->beNotified()->save();
 
-    $this->_helper->_notify($this->_('Les notifications de nouveautés pour la recherche "%s" sont activées.', $search->getLabel()));
+    $this->_helper->notify($this->_('Les notifications de nouveautés pour la recherche "%s" sont activées.', $search->getLabel()));
     $this->_redirectToIndex();
   }
 
@@ -93,7 +93,7 @@ class ZendAfi_Controller_Plugin_Manager_BookmarkedSearches extends ZendAfi_Contr
 
     $search->beUnnotified()->save();
 
-    $this->_helper->_notify($this->_('Les notifications de nouveautés pour la recherche "%s" sont désactivées.', $search->getLabel()));
+    $this->_helper->notify($this->_('Les notifications de nouveautés pour la recherche "%s" sont désactivées.', $search->getLabel()));
 
     $this->_redirectToIndex();
   }
diff --git a/tests/application/modules/AbstractControllerTestCase.php b/tests/application/modules/AbstractControllerTestCase.php
index 6ad5af88956..43dcfb7d90a 100644
--- a/tests/application/modules/AbstractControllerTestCase.php
+++ b/tests/application/modules/AbstractControllerTestCase.php
@@ -198,6 +198,7 @@ abstract class AbstractControllerTestCase extends Zend_Test_PHPUnit_ControllerTe
     Class_FileManager::reset();
     Class_Notice_Xsl::reset();
     Class_CommSigb::setInstance(null);
+    ZendAfi_Acl_AdminControllerGroup::setAcl(null);
   }
 
 
diff --git a/tests/scenarios/AuthorBrowser/AuthorBrowserTest.php b/tests/scenarios/AuthorBrowser/AuthorBrowserTest.php
index ec3335c868d..be3138f4d1a 100644
--- a/tests/scenarios/AuthorBrowser/AuthorBrowserTest.php
+++ b/tests/scenarios/AuthorBrowser/AuthorBrowserTest.php
@@ -29,6 +29,8 @@ abstract class AuthorBrowserTestCase extends Admin_AbstractControllerTestCase {
   public function setUp() {
     parent::setUp();
 
+    Class_AdminVar::set('CODIFICATION_BROWSER', 1);
+
     $this->_erroc = $this->fixture('Class_CodifAuteur',
                                    ['id' => 15,
                                     'libelle' => 'Erroc']);
diff --git a/tests/scenarios/Pcdm4Browser/Pcdm4BrowserTest.php b/tests/scenarios/Pcdm4Browser/Pcdm4BrowserTest.php
index 117f236e09b..65357637681 100644
--- a/tests/scenarios/Pcdm4Browser/Pcdm4BrowserTest.php
+++ b/tests/scenarios/Pcdm4Browser/Pcdm4BrowserTest.php
@@ -25,6 +25,9 @@ class Pcdm4BrowserIndexChildrenTest extends Admin_AbstractControllerTestCase{
 
   public function setUp() {
     parent::setUp();
+
+    Class_AdminVar::set('CODIFICATION_BROWSER', 1);
+
     $mainstream = $this->fixture('Class_CodifPcdm4',
                                  ['id' => '0',
                                   'libelle' => 'Mainstream']);
-- 
GitLab