From ea8353fa19694be27a55bb86318f525ce2fddb7f Mon Sep 17 00:00:00 2001
From: gloas <gloas@afi-sa.fr>
Date: Mon, 6 Feb 2017 14:40:31 +0100
Subject: [PATCH] dev #55145 move LeKiosk to plugin

---
 VERSIONS_WIP/55145                            |   1 +
 .../opac/controllers/ModulesController.php    |   1 -
 library/Class/AdminVar.php                    |  18 --
 .../Lekiosk}/CasLink.php                      |   2 +-
 library/digital_resources/Lekiosk/Config.php  |  69 +++++
 .../Lekiosk}/Link.php                         |   8 +-
 .../digital_resources/Lekiosk/ModuleMenu.php  |  24 ++
 .../Lekiosk/controllers/IndexController.php}  |  30 +--
 .../Lekiosk/tests/LeKioskTest.php             | 237 ++++++++++++++++++
 .../controllers/ModulesControllerTest.php     | 102 +-------
 tests/library/Class/LeKioskLinkTest.php       |  92 -------
 11 files changed, 337 insertions(+), 247 deletions(-)
 create mode 100644 VERSIONS_WIP/55145
 rename library/{Class/LeKiosk => digital_resources/Lekiosk}/CasLink.php (97%)
 create mode 100644 library/digital_resources/Lekiosk/Config.php
 rename library/{Class/LeKiosk => digital_resources/Lekiosk}/Link.php (91%)
 create mode 100644 library/digital_resources/Lekiosk/ModuleMenu.php
 rename library/{Class/Systeme/ModulesMenu/LeKiosk.php => digital_resources/Lekiosk/controllers/IndexController.php} (52%)
 create mode 100644 library/digital_resources/Lekiosk/tests/LeKioskTest.php
 delete mode 100644 tests/library/Class/LeKioskLinkTest.php

diff --git a/VERSIONS_WIP/55145 b/VERSIONS_WIP/55145
new file mode 100644
index 00000000000..f77d73b80d6
--- /dev/null
+++ b/VERSIONS_WIP/55145
@@ -0,0 +1 @@
+ - ticket #55145 : [contractuel] 24/55 Le Kiosk : recherche fédérée
\ No newline at end of file
diff --git a/application/modules/opac/controllers/ModulesController.php b/application/modules/opac/controllers/ModulesController.php
index fe063e77517..6a3bf1c9df4 100644
--- a/application/modules/opac/controllers/ModulesController.php
+++ b/application/modules/opac/controllers/ModulesController.php
@@ -23,7 +23,6 @@ class ModulesController extends ZendAfi_Controller_Action {
   public function preDispatch() {
     $mapping = ['vodeclic' => 'Vodeclic',
                 'toutapprendre' => 'ToutApprendre',
-                'lekiosk' => 'LeKiosk',
                 'lesocial' => 'LeSocial',
                 'mycow' => 'MyCow',
                 'planetnemo' => 'PlanetNemo',
diff --git a/library/Class/AdminVar.php b/library/Class/AdminVar.php
index cd3cb981b6c..1b438c128c9 100644
--- a/library/Class/AdminVar.php
+++ b/library/Class/AdminVar.php
@@ -317,13 +317,6 @@ class Class_AdminVarLoader extends Storm_Model_Loader {
 
             'LECTURA_DOMAIN' => Class_AdminVar_Meta::newDefault($this->_('Domaine utilisée par le serveur lectura pour authentification')),
 
-            'LEKIOSK_ID' => Class_AdminVar_Meta::newDefault($this->_('Identifiant fournit par lekiosk.com'))->bePrivate(),
-
-            'LEKIOSK_SSO_MODE' => Class_AdminVar_Meta::newCombo($this->_('Type de SSO lekiosk.com'),
-                                                                ['options' => ['selectOptions' => ['label' => $this->_('Mode d\'authentification'),
-                                                                                                   'multioptions' => ['' => 'Lien',
-                                                                                                                      'CAS' => 'CAS']]]])->bePrivate(),
-
             'KIDILANGUES_VERSION' => Class_AdminVar_Meta::newCombo($this->_('Version de Kidilangues.'),
                                                                    ['options' => ['selectOptions' => ['label' => $this->_('Version'),
                                                                                                       'multioptions' => ['1' => '1', '2' => '2']]]])->bePrivate(),
@@ -691,17 +684,6 @@ class Class_AdminVarLoader extends Storm_Model_Loader {
   }
 
 
-  public function isLeKioskEnabled() {
-    return '' != Class_AdminVar::get('LEKIOSK_ID');
-  }
-
-
-  public function isLeKioskCas() {
-    return Class_AdminVar::isLeKioskEnabled()
-      && 'CAS' == Class_AdminVar::get('LEKIOSK_SSO_MODE');
-  }
-
-
   public function isOrpheaEnabled() {
     return (('' != Class_AdminVar::get('ORPHEA_URL'))
             && ('' != Class_AdminVar::get('ORPHEA_USERNAME'))
diff --git a/library/Class/LeKiosk/CasLink.php b/library/digital_resources/Lekiosk/CasLink.php
similarity index 97%
rename from library/Class/LeKiosk/CasLink.php
rename to library/digital_resources/Lekiosk/CasLink.php
index 83e04ac0031..c9c465cd460 100644
--- a/library/Class/LeKiosk/CasLink.php
+++ b/library/digital_resources/Lekiosk/CasLink.php
@@ -20,7 +20,7 @@
  */
 
 
-class Class_LeKiosk_CasLink {
+class Lekiosk_CasLink {
   public function url() {
     return 'https://pro.lekiosk.com/AutentificationCas.aspx?'
       . http_build_query(
diff --git a/library/digital_resources/Lekiosk/Config.php b/library/digital_resources/Lekiosk/Config.php
new file mode 100644
index 00000000000..114202794ba
--- /dev/null
+++ b/library/digital_resources/Lekiosk/Config.php
@@ -0,0 +1,69 @@
+<?php
+/**
+ * Copyright (c) 2012-2016, Agence Française Informatique (AFI). All rights reserved.
+ *
+ * BOKEH 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).
+ *
+ * BOKEH 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 BOKEH; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
+ */
+
+class Lekiosk_Config extends Class_DigitalResource_Config {
+
+  public function getConfig() {
+    return [
+            'DocTypeLabel' => $this->_('LeKiosk'),
+            'PermissionLabel' => $this->_('Bibliothèque numérique: accéder à LeKiosk'),
+            'MenuLabel' => $this->_('Lien vers LeKiosk'),
+            'Introduction' => $this->_('Retrouvez vos magazines préférés en numérique parmi plus de 1600 titres. Un univers riche et varié, des dernières parutions aux anciens numéros.'),
+            'NotAllowedMessage' => $this->_('Vous n\'avez pas accès à cette ressource.'),
+
+            'HelpLink' => 'http://wiki.bokeh-library-portal.org/index.php/Le_Kiosk',
+            'Url' => 'http://www.lekiosk.com/',
+            'Icon' => 'http://bokeh-library-portal.org/userfiles/media/ressources_numeriques/lekiosk.png',
+
+            'MailUrl' => 'http://get.lekiosk.com/pro/?utm_source=LK&utm_campaign=B2B&utm_medium=footer',
+
+            'AdminVars' => [
+                            'LEKIOSK_ID' => Class_AdminVar_Meta::newDefault($this->_('Identifiant fournit par LeKiosk'))->bePrivate(),
+                            'LEKIOSK_SSO_MODE' => Class_AdminVar_Meta::newCombo($this->_('Type de SSO lekiosk.com'),
+                                                                                ['options' => ['selectOptions' => ['label' => $this->_('Mode d\'authentification'),
+                                                                                                                   'multioptions' => ['' => 'Lien',
+                                                                                                                                      'CAS' => 'CAS']]]])->bePrivate()
+            ],
+
+            'SsoAction' => 'lekiosk',
+            'ModuleMenu' => 'Lekiosk_ModuleMenu',
+    ];
+  }
+
+
+  public function getSsoUrl($user) {
+    $link = $this->isLeKioskCas()
+      ? new Lekiosk_CasLink()
+      : new Lekiosk_Link($user->getMail());
+    return $link->url();
+  }
+
+
+  public function isLeKioskCas() {
+    return $this->isEnabled()
+      && 'CAS' == Class_AdminVar::get('LEKIOSK_SSO_MODE');
+  }
+
+
+  public function isEnabled() {
+    return Class_AdminVar::get('LEKIOSK_ID');
+  }
+}
diff --git a/library/Class/LeKiosk/Link.php b/library/digital_resources/Lekiosk/Link.php
similarity index 91%
rename from library/Class/LeKiosk/Link.php
rename to library/digital_resources/Lekiosk/Link.php
index 4a6ff8c9b35..92fbf0966f3 100644
--- a/library/Class/LeKiosk/Link.php
+++ b/library/digital_resources/Lekiosk/Link.php
@@ -20,7 +20,7 @@
  */
 
 
-class Class_LeKiosk_Link {
+class Lekiosk_Link {
   const ROOT_URL = 'http://pro.lekiosk.com';
   const BASE_URL = '/lekiosque.authenticate.aspx?';
   const AES_KEY = '56FGH4sTOV9ZXr4Q';
@@ -30,12 +30,6 @@ class Class_LeKiosk_Link {
   protected $_base_url;
 
 
-  public static function newFor($mail) {
-    return Class_AdminVar::isLeKioskCas()
-      ? new Class_LeKiosk_CasLink() : new self($mail);
-  }
-
-
   public function __construct($mail) {
     $this->_mail = ($mail) ? $mail : Class_Profil::getPortail()->getMailSiteOrPortail();
   }
diff --git a/library/digital_resources/Lekiosk/ModuleMenu.php b/library/digital_resources/Lekiosk/ModuleMenu.php
new file mode 100644
index 00000000000..286b07f4657
--- /dev/null
+++ b/library/digital_resources/Lekiosk/ModuleMenu.php
@@ -0,0 +1,24 @@
+<?php
+/**
+ * Copyright (c) 2012-2017, Agence Française Informatique (AFI). All rights reserved.
+ *
+ * BOKEH 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).
+ *
+ * BOKEH 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 BOKEH; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
+ */
+
+
+class Lekiosk_ModuleMenu extends Class_DigitalResource_ModuleMenu {}
+?>
\ No newline at end of file
diff --git a/library/Class/Systeme/ModulesMenu/LeKiosk.php b/library/digital_resources/Lekiosk/controllers/IndexController.php
similarity index 52%
rename from library/Class/Systeme/ModulesMenu/LeKiosk.php
rename to library/digital_resources/Lekiosk/controllers/IndexController.php
index 515d4b7d99a..125bc8eb5be 100644
--- a/library/Class/Systeme/ModulesMenu/LeKiosk.php
+++ b/library/digital_resources/Lekiosk/controllers/IndexController.php
@@ -19,34 +19,6 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
  */
 
-class Class_Systeme_ModulesMenu_LeKiosk extends Class_Systeme_ModulesMenu_SSOAbstract {
-  /** @var string */
-  protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES;
 
-  /** @var string */
-  protected $_type_module = 'LEKIOSK';
-
-  /** @var string */
-  protected $_libelle = 'Lien vers LeKiosk';
-
-  protected $_url = [
-    'controller' => 'modules',
-    'action' => 'lekiosk'
-  ];
-
-
-  public function urlForUser($user) {
-    if (!$user->hasRightAccesLeKiosk()) {
-      $this->setMessage($this->_('Votre abonnement ne permet pas d\'accéder aux ressources LeKiosk. Merci de contacter la médiathèque'));
-      return '';
-    }
-
-    return Class_LeKiosk_Link::newFor($user->getMail())->url();
-  }
-
-  public function isVisibleForProfil($profil) {
-    return Class_AdminVar::isLeKioskEnabled();
-  }
-
-}
+class Lekiosk_Plugin_IndexController extends Class_DigitalResource_Controller {}
 ?>
\ No newline at end of file
diff --git a/library/digital_resources/Lekiosk/tests/LeKioskTest.php b/library/digital_resources/Lekiosk/tests/LeKioskTest.php
new file mode 100644
index 00000000000..245184fc661
--- /dev/null
+++ b/library/digital_resources/Lekiosk/tests/LeKioskTest.php
@@ -0,0 +1,237 @@
+<?php
+/**
+ * Copyright (c) 2012-2017, Agence Française Informatique (AFI). All rights reserved.
+ *
+ * BOKEH 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).
+ *
+ * BOKEH 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 BOKEH; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
+ */
+
+
+
+abstract class LeKioskLinkModeLinkTestCase extends ModelTestCase {
+  protected
+    $_storm_default_to_volatile = true,
+    $_lekiosk_config;
+
+  public function setUp() {
+    parent::setUp();
+    $this->fixture('Class_Profil', [
+      'id' => 1,
+      'libelle' => 'portail',
+      'mail_site' => '']);
+
+    Class_AdminVar::set('LEKIOSK_ID', '29');
+
+    $this->_lekiosk_config =
+      new Assimil_Config(new Class_DigitalResource_Wrapper (Class_DigitalResource::getInstance(), 'LeKiosk'));
+    $this->_module_menu = new Class_DigitalResource_ModuleMenu($this->_lekiosk_config);
+  }
+}
+
+
+
+
+class LeKioskLinkModeLinkTest extends LeKioskLinkModeLinkTestCase {
+  /** @test */
+  public function urlForMyemailAtLekioskDotComShouldContainsEncryptedEmail() {
+    $expected = 'http://pro.lekiosk.com/lekiosque.authenticate.aspx?email=1671f18f515f49271985280397c1c2bc48e1bfa31a3b638cb22e510e4953d65e&id=29&AccessHash=e6715cdcc53d6d2b130f4025ea44b67872eb5455';
+    $this->assertEquals(
+      $expected,
+                        (new Lekiosk_Link('myemail@lekiosk.com'))->url()
+    );
+  }
+
+
+  /** @test */
+  public function withoutMailShouldBeNotContainsEmailKey() {
+    $expected = 'http://pro.lekiosk.com/lekiosque.authenticate.aspx?email=18ca3d8ad40255ce09d5d20debc1e069&id=29&AccessHash=b78f9cd4198878b85de383ccddd27ab286fc47f6';
+    $this->assertEquals($expected, (new Lekiosk_Link(''))->url());
+  }
+
+
+  /** @test */
+  public function withEmptyUserMailShouldGetSiteOrProfileMail() {
+    Class_Profil::find(1)->setMailSite('toto@example.com');
+    $expected = 'http://pro.lekiosk.com/lekiosque.authenticate.aspx?email=76903fe54055ab757db99c2370d89970e25c5b33b5a69cafc108c0031685af88&id=29&AccessHash=c5d56beb8fbd723bc562739cbc3f70ed43a79b9e';
+    $this->assertEquals($expected, (new Lekiosk_Link(''))->url());
+  }
+}
+
+
+
+
+class LeKioskLinkModeSSOTest extends LeKioskLinkModeLinkTestCase {
+  public function setUp() {
+    parent::setUp();
+
+    $_SERVER['HTTP_REFERER'] = 'http://localhost/view/notice';
+    Zend_Controller_Front::getInstance()
+      ->getRouter()
+      ->route(new Zend_Controller_Request_Http('http://localhost/'));
+    Class_AdminVar::set('LEKIOSK_SSO_MODE', 'CAS');
+  }
+
+
+  /** @test */
+  public function linkShouldBeCasUrlWithLeKioskId() {
+    $url = 'https://pro.lekiosk.com/AutentificationCas.aspx?'
+      .'cas_fournisseur=' . urlencode(ROOT_URL . BASE_URL . '/cas-server-v10')
+      .'&id=29'
+      .'&ReturnUrl=';
+
+    $this->assertEquals($url,
+                        (new Lekiosk_CasLink(''))->url());
+  }
+}
+
+
+
+
+
+class ModulesControllerLeKioskUserWithGroupWithRightCasTest extends AbstractControllerTestCase {
+  protected $_storm_default_to_volatile = true;
+
+  public function setUp() {
+    parent::setUp();
+
+    RessourcesNumeriquesFixtures::activateLeKiosk();
+    $group = $this->fixture('Class_UserGroup', ['id' => 1])
+                  ->addRight(Class_UserGroup::RIGHT_ACCES_LEKIOSK);
+    Class_Users::getIdentity()->setUserGroups([$group]);
+    Class_AdminVar::set('LEKIOSK_SSO_MODE', 'CAS');
+    $_SERVER['HTTP_REFERER'] = 'http://localhost/view/notice';
+
+    $this->dispatch('/opac/modules/lekiosk', true);
+  }
+
+
+  /** @test */
+  public function shouldHaveAccessToLekiosk() {
+    $this->assertContains('https://pro.lekiosk.com/AutentificationCas.aspx',
+                          $this->_response->getBody());
+  }
+}
+
+
+
+
+class LeKioskModulesControllerLoginRequiredTest extends AbstractControllerTestCase {
+  protected $_storm_default_to_volatile = true;
+
+  public function datas() {
+    return [
+            ['LeKiosk', 'lekiosk']
+    ];
+  }
+
+
+  /**
+   * @test
+   * @dataProvider datas
+   */
+  public function withoutLoginShouldRedirectToLogin($type, $action) {
+    call_user_func(['RessourcesNumeriquesFixtures', 'activate' . $type]);
+
+    $_SERVER['HTTP_REFERER'] = '/opac/cms/articleview/id/23';
+    ZendAfi_Auth::getInstance()->clearIdentity();
+
+    $this->dispatch('/opac/modules/' . $action);
+
+    $this->assertContains('/auth/login?redirect='.urlencode(ROOT_URL . BASE_URL . '/modules/' . $action),
+                          $this->_response->getBody());
+  }
+}
+
+
+
+class ModulesControllerLoginRequiredLeKioskCasTest extends AbstractControllerTestCase {
+  protected $_storm_default_to_volatile = true;
+
+  /** @test */
+  public function shouldRedirectToLogin() {
+    RessourcesNumeriquesFixtures::activateLeKiosk();
+
+    Class_AdminVar::set('LEKIOSK_SSO_MODE', 'CAS');
+    $_SERVER['HTTP_REFERER'] = '/opac/cms/articleview/id/23';
+    ZendAfi_Auth::getInstance()->clearIdentity();
+
+    $this->dispatch('/opac/modules/lekiosk', true);
+
+    $this->assertContains('/auth/login?redirect='.urlencode(ROOT_URL . BASE_URL . '/modules/lekiosk'),
+                          $this->_response->getBody());
+  }
+}
+
+
+
+
+class ModulesControllerLeKioskUserWithoutGroupTest extends AbstractControllerTestCase {
+  public function setUp() {
+    parent::setUp();
+    RessourcesNumeriquesFixtures::activateLeKiosk();
+    $this->dispatch('/opac/modules/lekiosk', true);
+  }
+
+
+  /** @test */
+  public function shouldHaveAccessForbiddenMessage() {
+    $this->assertFlashMessengerContentContains('Votre abonnement ne permet pas');
+  }
+}
+
+
+
+
+class ModulesControllerLeKioskUserWithGroupWithoutRightTest extends AbstractControllerTestCase {
+  public function setUp() {
+    parent::setUp();
+    RessourcesNumeriquesFixtures::activateLeKiosk();
+    $group = $this->fixture('Class_UserGroup', ['id' => 1]);
+    Class_Users::getIdentity()->setUserGroups([$group]);
+    $this->dispatch('/opac/modules/lekiosk', true);
+  }
+
+
+  /** @test */
+  public function shouldHaveAccessForbiddenMessage() {
+    $this->assertFlashMessengerContentContains('Votre abonnement ne permet pas');
+  }
+}
+
+
+
+class ModulesControllerLeKioskUserWithGroupWithRightTest extends AbstractControllerTestCase {
+  protected $_storm_default_to_volatile = true;
+
+  public function setUp() {
+    parent::setUp();
+
+    RessourcesNumeriquesFixtures::activateLeKiosk();
+    $group = $this->fixture('Class_UserGroup', ['id' => 1])
+                  ->addRight(Class_UserGroup::RIGHT_ACCES_LEKIOSK);
+    Class_Users::getIdentity()->setUserGroups([$group]);
+
+    $this->dispatch('/opac/modules/lekiosk', true);
+  }
+
+
+  /** @test */
+  public function shouldHaveAccessToLekiosk() {
+    $this->assertContains('http://pro.lekiosk.com', $this->_response->getBody());
+  }
+}
+
+?>
\ No newline at end of file
diff --git a/tests/application/modules/opac/controllers/ModulesControllerTest.php b/tests/application/modules/opac/controllers/ModulesControllerTest.php
index 6eb4a604957..4cee8f6e645 100644
--- a/tests/application/modules/opac/controllers/ModulesControllerTest.php
+++ b/tests/application/modules/opac/controllers/ModulesControllerTest.php
@@ -21,6 +21,8 @@
 require_once 'AbstractControllerTestCase.php';
 include_once('tests/fixtures/RessourcesNumeriquesFixtures.php');
 
+
+
 class ModulesControllerLoginRequiredTest extends AbstractControllerTestCase {
   protected $_storm_default_to_volatile = true;
 
@@ -28,8 +30,7 @@ class ModulesControllerLoginRequiredTest extends AbstractControllerTestCase {
     return [
             ['CVS', 'cvs'],
             ['Vodeclic', 'vodeclic'],
-            ['ToutApprendre', 'toutapprendre'],
-            ['LeKiosk', 'lekiosk']
+            ['ToutApprendre', 'toutapprendre']
     ];
   }
 
@@ -53,39 +54,6 @@ class ModulesControllerLoginRequiredTest extends AbstractControllerTestCase {
 
 
 
-class ModulesControllerLoginRequiredLeKioskCasTest extends AbstractControllerTestCase {
-  protected $_storm_default_to_volatile = true;
-
-  /** @test */
-  public function shouldRedirectToLogin() {
-    RessourcesNumeriquesFixtures::activateLeKiosk();
-
-    Class_AdminVar::set('LEKIOSK_SSO_MODE', 'CAS');
-    $_SERVER['HTTP_REFERER'] = '/opac/cms/articleview/id/23';
-    ZendAfi_Auth::getInstance()->clearIdentity();
-
-    $this->dispatch('/opac/modules/lekiosk');
-
-    $this->assertContains('/auth/login?redirect='.urlencode(ROOT_URL . BASE_URL . '/modules/lekiosk'),
-                          $this->_response->getBody());
-  }
-}
-
-
-
-class ModulesControllerLeKioskUserWithoutGroupTest extends AbstractControllerTestCase {
-  public function setUp() {
-    parent::setUp();
-    RessourcesNumeriquesFixtures::activateLeKiosk();
-    $this->dispatch('/opac/modules/lekiosk', true);
-  }
-
-
-  /** @test */
-  public function shouldHaveAccessForbiddenMessage() {
-    $this->assertFlashMessengerContentContains('Votre abonnement ne permet pas');
-  }
-}
 
 class ModulesControllerLeSocialWithoutGroupTest extends AbstractControllerTestCase {
   public function setUp() {
@@ -115,70 +83,6 @@ class ModulesControllerLeSocialWithGroupTest extends AbstractControllerTestCase
   }
 }
 
-class ModulesControllerLeKioskUserWithGroupWithoutRightTest extends AbstractControllerTestCase {
-  public function setUp() {
-    parent::setUp();
-    RessourcesNumeriquesFixtures::activateLeKiosk();
-    $group = $this->fixture('Class_UserGroup', ['id' => 1]);
-    Class_Users::getIdentity()->setUserGroups([$group]);
-    $this->dispatch('/opac/modules/lekiosk', true);
-  }
-
-
-  /** @test */
-  public function shouldHaveAccessForbiddenMessage() {
-    $this->assertFlashMessengerContentContains('Votre abonnement ne permet pas');
-  }
-}
-
-
-
-class ModulesControllerLeKioskUserWithGroupWithRightTest extends AbstractControllerTestCase {
-  protected $_storm_default_to_volatile = true;
-
-  public function setUp() {
-    parent::setUp();
-
-    RessourcesNumeriquesFixtures::activateLeKiosk();
-    $group = $this->fixture('Class_UserGroup', ['id' => 1])
-                  ->addRight(Class_UserGroup::RIGHT_ACCES_LEKIOSK);
-    Class_Users::getIdentity()->setUserGroups([$group]);
-
-    $this->dispatch('/opac/modules/lekiosk', true);
-  }
-
-
-  /** @test */
-  public function shouldHaveAccessToLekiosk() {
-    $this->assertContains('http://pro.lekiosk.com', $this->_response->getBody());
-  }
-}
-
-
-
-class ModulesControllerLeKioskUserWithGroupWithRightCasTest extends AbstractControllerTestCase {
-  protected $_storm_default_to_volatile = true;
-
-  public function setUp() {
-    parent::setUp();
-
-    RessourcesNumeriquesFixtures::activateLeKiosk();
-    $group = $this->fixture('Class_UserGroup', ['id' => 1])
-                  ->addRight(Class_UserGroup::RIGHT_ACCES_LEKIOSK);
-    Class_Users::getIdentity()->setUserGroups([$group]);
-    Class_AdminVar::set('LEKIOSK_SSO_MODE', 'CAS');
-    $_SERVER['HTTP_REFERER'] = 'http://localhost/view/notice';
-
-    $this->dispatch('/opac/modules/lekiosk', true);
-  }
-
-
-  /** @test */
-  public function shouldHaveAccessToLekiosk() {
-    $this->assertContains('https://pro.lekiosk.com/AutentificationCas.aspx',
-                          $this->_response->getBody());
-  }
-}
 
 
 
diff --git a/tests/library/Class/LeKioskLinkTest.php b/tests/library/Class/LeKioskLinkTest.php
deleted file mode 100644
index 9089b1199cf..00000000000
--- a/tests/library/Class/LeKioskLinkTest.php
+++ /dev/null
@@ -1,92 +0,0 @@
-<?php
-/**
- * Copyright (c) 2012-2014, Agence Française Informatique (AFI). All rights reserved.
- *
- * BOKEH 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).
- *
- * BOKEH 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 BOKEH; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
- */
-
-abstract class LeKioskLinkModeLinkTestCase extends ModelTestCase {
-  protected
-    $_storm_default_to_volatile = true;
-
-  public function setUp() {
-    parent::setUp();
-    $this->fixture('Class_Profil', [
-      'id' => 1,
-      'libelle' => 'portail',
-      'mail_site' => '']);
-
-    Class_AdminVar::set('LEKIOSK_ID', '29');
-  }
-}
-
-
-
-
-class LeKioskLinkModeLinkTest extends LeKioskLinkModeLinkTestCase {
-  /** @test */
-  public function urlForMyemailAtLekioskDotComShouldContainsEncryptedEmail() {
-    $expected = 'http://pro.lekiosk.com/lekiosque.authenticate.aspx?email=1671f18f515f49271985280397c1c2bc48e1bfa31a3b638cb22e510e4953d65e&id=29&AccessHash=e6715cdcc53d6d2b130f4025ea44b67872eb5455';
-    $this->assertEquals(
-      $expected,
-      Class_LeKiosk_Link::newFor('myemail@lekiosk.com')->url()
-    );
-  }
-
-
-  /** @test */
-  public function withoutMailShouldBeNotContainsEmailKey() {
-    $expected = 'http://pro.lekiosk.com/lekiosque.authenticate.aspx?email=18ca3d8ad40255ce09d5d20debc1e069&id=29&AccessHash=b78f9cd4198878b85de383ccddd27ab286fc47f6';
-    $this->assertEquals($expected, Class_LeKiosk_Link::newFor('')->url());
-  }
-
-
-  /** @test */
-  public function withEmptyUserMailShouldGetSiteOrProfileMail() {
-    Class_Profil::find(1)->setMailSite('toto@example.com');
-    $expected = 'http://pro.lekiosk.com/lekiosque.authenticate.aspx?email=76903fe54055ab757db99c2370d89970e25c5b33b5a69cafc108c0031685af88&id=29&AccessHash=c5d56beb8fbd723bc562739cbc3f70ed43a79b9e';
-    $this->assertEquals($expected, Class_LeKiosk_Link::newFor('')->url());
-  }
-}
-
-
-
-
-class LeKioskLinkModeSSOTest extends LeKioskLinkModeLinkTestCase {
-  public function setUp() {
-    parent::setUp();
-
-    $_SERVER['HTTP_REFERER'] = 'http://localhost/view/notice';
-    Zend_Controller_Front::getInstance()
-      ->getRouter()
-      ->route(new Zend_Controller_Request_Http('http://localhost/'));
-    Class_AdminVar::set('LEKIOSK_SSO_MODE', 'CAS');
-  }
-
-
-  /** @test */
-  public function linkShouldBeCasUrlWithLeKioskId() {
-    $url = 'https://pro.lekiosk.com/AutentificationCas.aspx?'
-      .'cas_fournisseur=' . urlencode(ROOT_URL . BASE_URL . '/cas-server-v10')
-      .'&id=29'
-      .'&ReturnUrl=';
-
-    $this->assertEquals($url,
-                        Class_LeKiosk_Link::newFor('')->url());
-  }
-}
-?>
\ No newline at end of file
-- 
GitLab