From 9c12b167e0776c44c030fecd8c1549829d149a79 Mon Sep 17 00:00:00 2001
From: gloas <gloas@git-test.afi-sa.fr>
Date: Mon, 14 Oct 2013 13:42:41 +0000
Subject: [PATCH] =?UTF-8?q?Admin=20Portail=20:=20La=20visibilit=C3=A9=20du?=
 =?UTF-8?q?=20catalogue=20OPDS=20n'est=20plus=20li=C3=A9e=20=C3=A0=20la=20?=
 =?UTF-8?q?variable=20BIBNUM.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Ajout tests sur le helper MenuGaucheAdmin
---
 .gitattributes                                |  1 +
 .../View/Helper/Admin/MenuGaucheAdmin.php     |  3 +-
 .../View/Helper/Admin/MenuGaucheAdminTest.php | 44 +++++++++++++++++++
 3 files changed, 46 insertions(+), 2 deletions(-)
 create mode 100644 tests/library/ZendAfi/View/Helper/Admin/MenuGaucheAdminTest.php

diff --git a/.gitattributes b/.gitattributes
index 82eaa299b43..17f2e4c15e3 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -5864,6 +5864,7 @@ tests/library/ZendAfi/View/Helper/Accueil/SitoTest.php -text
 tests/library/ZendAfi/View/Helper/Accueil/TagsTest.php -text
 tests/library/ZendAfi/View/Helper/Admin/AdminHelpLinkTest.php -text
 tests/library/ZendAfi/View/Helper/Admin/ImageViewersOptionsTest.php -text
+tests/library/ZendAfi/View/Helper/Admin/MenuGaucheAdminTest.php -text
 tests/library/ZendAfi/View/Helper/Admin/TagSelectionChampsTest.php -text
 tests/library/ZendAfi/View/Helper/AudioJSPlayerTest.php -text
 tests/library/ZendAfi/View/Helper/AvisTest.php -text
diff --git a/library/ZendAfi/View/Helper/Admin/MenuGaucheAdmin.php b/library/ZendAfi/View/Helper/Admin/MenuGaucheAdmin.php
index d5a5cadfa0e..9961c8fdea6 100644
--- a/library/ZendAfi/View/Helper/Admin/MenuGaucheAdmin.php
+++ b/library/ZendAfi/View/Helper/Admin/MenuGaucheAdmin.php
@@ -35,7 +35,6 @@ class ZendAfi_View_Helper_Admin_MenuGaucheAdmin extends ZendAfi_View_Helper_Base
 		$this->addTitleIconJS();
 
 		// User connecté
-		
 		$this->user = Class_Users::getIdentity();
 
 		$moderer = new Class_Moderer();
@@ -87,8 +86,8 @@ class ZendAfi_View_Helper_Admin_MenuGaucheAdmin extends ZendAfi_View_Helper_Base
 		if (Class_AdminVar::isToutApprendreEnabled())
 			$menu_bibnum .= $this->addMenu("oai_16.png",				$this->translate()->_("Tout Apprendre"),							"/admin/harvest/toutapprendre-browse",	$filter_admins($this->user));
 
+		$menu_bibnum .= $this->addMenu("epub_16.png",						$this->translate()->_("Catalogues OPDS"),				"/admin/opds",								 $filter_admins($this->user) || $this->user->hasRightToAccess(Class_UserGroup::RIGHT_USER_OPDS_READ));
 		if (Class_AdminVar::isBibNumEnabled()) {
-			$menu_bibnum .= $this->addMenu("epub_16.png",						$this->translate()->_("Catalogues OPDS"),				"/admin/opds",								 $filter_admins($this->user) || $this->user->hasRightToAccess(Class_UserGroup::RIGHT_USER_OPDS_READ));
 			$menu_bibnum .= $this->addMenu("oai_16.png",						$this->translate()->_("Entrepôts OAI"),					"/admin/oai",									 $filter_admins($this->user));
 			$menu_bibnum .= $this->addMenu("ead_16.png",						$this->translate()->_("Import/Export EAD"),						"/admin/album/import_ead",		 $filter_admins($this->user));
 		} 
diff --git a/tests/library/ZendAfi/View/Helper/Admin/MenuGaucheAdminTest.php b/tests/library/ZendAfi/View/Helper/Admin/MenuGaucheAdminTest.php
new file mode 100644
index 00000000000..dbb0ccdd967
--- /dev/null
+++ b/tests/library/ZendAfi/View/Helper/Admin/MenuGaucheAdminTest.php
@@ -0,0 +1,44 @@
+<?php
+/**
+ * Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved.
+ *
+ * AFI-OPAC 2.0 is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
+ * the Free Software Foundation.
+ *
+ * There are special exceptions to the terms and conditions of the AGPL as it
+ * is applied to this software (see README file).
+ *
+ * AFI-OPAC 2.0 is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * along with AFI-OPAC 2.0; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA 
+ */
+require_once 'library/ZendAfi/View/Helper/ViewHelperTestCase.php';
+
+class MenuGaucheAdminHelperWithVariableBibnumDisabledTest extends ViewHelperTestCase {
+	protected $html;
+
+	public function setUp() {
+		parent::setUp();
+	  $this->login(ZendAfi_Acl_AdminControllerRoles::ADMIN_PORTAIL);
+		Class_AdminVar::newInstanceWithId('BIBNUM', ['valeur'=>0]);
+		
+		$this->helper = new ZendAfi_View_Helper_Admin_MenuGaucheAdmin();
+		$this->html = $this->helper->menuGaucheAdmin();
+	}
+
+
+	/** @test **/
+	public function BibNumEpudShouldBePresent() {
+		$this->assertXPath($this->html, '//a[@href="/afi-opac/admin/opds"]', $this->html);
+	}
+
+}
+
+?>
+
-- 
GitLab