From 6e5ee097356107f8cbfe9ad0d0213abba8a40bc7 Mon Sep 17 00:00:00 2001
From: gloas <gloas@afi-sa.fr>
Date: Thu, 31 May 2018 15:38:08 +0200
Subject: [PATCH] dev #75742 fix failures

---
 library/ZendAfi/Acl/AdminControllerRoles.php             | 1 +
 .../controllers/AlbumControllerListViewModeTest.php      | 8 ++++----
 .../ZendAfi/View/Helper/Admin/MenuGaucheAdminTest.php    | 2 ++
 tests/scenarios/Thesauri/ThesauriTest.php                | 9 +++++++++
 4 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/library/ZendAfi/Acl/AdminControllerRoles.php b/library/ZendAfi/Acl/AdminControllerRoles.php
index 7bd00f57c00..33833e2f13d 100644
--- a/library/ZendAfi/Acl/AdminControllerRoles.php
+++ b/library/ZendAfi/Acl/AdminControllerRoles.php
@@ -170,6 +170,7 @@ class ZendAfi_Acl_AdminControllerRoles extends Zend_Acl {
     $this->deny('modo_portail','systeme');
     $this->deny('modo_portail','batch');
     $this->deny('modo_portail','search-form');
+    $this->deny('modo_portail','thesauri');
 
     $this->allow('modo_portail');
     $this->allow('admin_portail');
diff --git a/tests/application/modules/admin/controllers/AlbumControllerListViewModeTest.php b/tests/application/modules/admin/controllers/AlbumControllerListViewModeTest.php
index 8db4fa93a6e..3ffd87a5d8b 100644
--- a/tests/application/modules/admin/controllers/AlbumControllerListViewModeTest.php
+++ b/tests/application/modules/admin/controllers/AlbumControllerListViewModeTest.php
@@ -166,13 +166,13 @@ class Admin_AlbumControllerListViewModeSearchTest extends Admin_AlbumControllerL
 
     $this->onLoaderOfModel('Class_Album')
          ->whenCalled('findAllBy')
-         ->with(['where' => 'titre like \'%Second%\'',
+         ->with(['where' => '(titre like \'%Second%\')',
                  'order' => 'titre',
                  'limitPage' => [0, 25]])
          ->answers([Class_Album::find(2)])
 
          ->whenCalled('countBy')
-         ->with(['where' => 'titre like \'%Second%\'',
+         ->with(['where' => '(titre like \'%Second%\')',
                  'order' => 'titre'])
          ->answers(200)
 
@@ -333,13 +333,13 @@ class Admin_AlbumControllerListViewModeSearchSpecialCharTest extends Admin_Album
 
     Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Album')
       ->whenCalled('findAllBy')
-      ->with(['where' => 'titre like \'%é%\'',
+      ->with(['where' => '(titre like \'%é%\')',
               'order' => 'titre',
               'limitPage' => [0, 25]])
       ->answers([Class_Album::find(2)])
 
       ->whenCalled('countBy')
-      ->with(['where' => 'titre like \'%é%\'',
+      ->with(['where' => '(titre like \'%é%\')',
               'order' => 'titre'])
       ->answers(200)
 
diff --git a/tests/library/ZendAfi/View/Helper/Admin/MenuGaucheAdminTest.php b/tests/library/ZendAfi/View/Helper/Admin/MenuGaucheAdminTest.php
index 21797ec21f7..67a1b6cb395 100644
--- a/tests/library/ZendAfi/View/Helper/Admin/MenuGaucheAdminTest.php
+++ b/tests/library/ZendAfi/View/Helper/Admin/MenuGaucheAdminTest.php
@@ -327,6 +327,7 @@ Trait MenuGaucheAdminRolesDefinition {
          'users',
          'usergroup',
          'file-manager',
+         'thesauri/index',
         ] ],
 
        [ZendAfi_Acl_AdminControllerRoles::MODO_BIB,
@@ -356,6 +357,7 @@ class ZendAfi_View_Helper_Admin_MenuGaucheAdminRightsTest extends ViewHelperTest
     Class_AdminVar::set('ACTIVITY', 1);
     Class_AdminVar::set('BIBNUM', 1);
     Class_AdminVar::set('SITO_IN_ALBUMS', 1);
+    Class_AdminVar::set('THESAURI_BROWSER', 1);
   }
 
 
diff --git a/tests/scenarios/Thesauri/ThesauriTest.php b/tests/scenarios/Thesauri/ThesauriTest.php
index d5504b53c84..15e8fe96385 100644
--- a/tests/scenarios/Thesauri/ThesauriTest.php
+++ b/tests/scenarios/Thesauri/ThesauriTest.php
@@ -196,6 +196,15 @@ class Thesauri_ThesauriAdminIndexDispatchTest extends Thesauri_ThesauriTestCase
 
   public function setUp() {
     parent::setUp();
+
+    $user = $this->fixture('Class_Users',
+                           ['id' => 65,
+                            'login' => 'admin',
+                            'password' => 'admin',
+                            'role_level' => ZendAfi_Acl_AdminControllerRoles::ADMIN_PORTAIL]);
+
+    ZendAfi_Auth::getInstance()->logUser($user);
+
     $this->dispatch('/admin/index', true);
   }
 
-- 
GitLab