diff --git a/VERSIONS_HOTLINE/138162 b/VERSIONS_HOTLINE/138162
new file mode 100644
index 0000000000000000000000000000000000000000..632740c1059b4ca03c185ecb64a8fc259d6c4e92
--- /dev/null
+++ b/VERSIONS_HOTLINE/138162
@@ -0,0 +1 @@
+ - ticket #138162 : Administration : Correction du lien de configuration de la liste des prêts de l'espace abonné
\ No newline at end of file
diff --git a/application/modules/opac/controllers/AbonneController.php b/application/modules/opac/controllers/AbonneController.php
index e4728c0c9f4996ad7e68d80caeaebb4533cb864f..a881c63aca85ea87c04e0161da67b9c9fbee1451 100644
--- a/application/modules/opac/controllers/AbonneController.php
+++ b/application/modules/opac/controllers/AbonneController.php
@@ -63,9 +63,11 @@ class AbonneController extends ZendAfi_Controller_Action {
       return;
     }
 
-    $this->view->_current_module['controller'] = 'abonne';
-    $this->view->_current_module['action'] = 'fiche';
-    $this->view->_current_module['action2'] = '';
+    if (!Class_Template::current()->isLegacy()) {
+      $this->view->_current_module['controller'] = 'abonne';
+      $this->view->_current_module['action'] = 'fiche';
+      $this->view->_current_module['action2'] = '';
+    }
   }
 
 
diff --git a/application/modules/opac/controllers/AuthorController.php b/application/modules/opac/controllers/AuthorController.php
index 6569616c233eae35dc7993c7e9765326a0e1cba1..b485fd936a565072890f25326a6aa09e8b6e1685 100644
--- a/application/modules/opac/controllers/AuthorController.php
+++ b/application/modules/opac/controllers/AuthorController.php
@@ -28,9 +28,11 @@ class AuthorController extends ZendAfi_Controller_Action {
     if (!$this->_author = $this->view->author = $this->_findAuthor())
       throw new Zend_Controller_Action_Exception($this->view->_('Désolé, cette page n\'existe pas'), 404);
 
-    $this->view->_current_module['controller'] = 'author';
-    $this->view->_current_module['action'] = 'view';
-    $this->view->_current_module['action2'] = '';
+    if (!Class_Template::current()->isLegacy()) {
+      $this->view->_current_module['controller'] = 'author';
+      $this->view->_current_module['action'] = 'view';
+      $this->view->_current_module['action2'] = '';
+    }
   }
 
 
diff --git a/application/modules/opac/controllers/BibController.php b/application/modules/opac/controllers/BibController.php
index 41dc0f6760133e3bcf331c13035f91585ac305e7..faa212bfa9bfb6f1c165fce7882a7f63dc472655 100644
--- a/application/modules/opac/controllers/BibController.php
+++ b/application/modules/opac/controllers/BibController.php
@@ -25,9 +25,11 @@ class BibController extends ZendAfi_Controller_Action {
     parent::preDispatch();
     $this->_helper->librarySelection();
 
-    $this->view->_current_module['controller'] = 'bib';
-    $this->view->_current_module['action'] = 'en-lire-plus';
-    $this->view->_current_module['action2'] = '';
+    if (!Class_Template::current()->isLegacy()) {
+      $this->view->_current_module['controller'] = 'bib';
+      $this->view->_current_module['action'] = 'en-lire-plus';
+      $this->view->_current_module['action2'] = '';
+    }
   }
 
 
diff --git a/tests/application/modules/opac/controllers/AbonneControllerPretsAdminTest.php b/tests/application/modules/opac/controllers/AbonneControllerPretsAdminTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..4b5cb13e9883498b2a24dbcb3e79279ab59b2654
--- /dev/null
+++ b/tests/application/modules/opac/controllers/AbonneControllerPretsAdminTest.php
@@ -0,0 +1,41 @@
+<?php
+/**
+ * Copyright (c) 2012-2021, 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 AbonneControllerPretsAdminTest extends AbstractControllerTestCase {
+  protected $_storm_default_to_volatile = true;
+
+
+  /** @test */
+  public function historicPageShouldContainsLinkToEditLoansConfig() {
+    $this->dispatch('/abonne/prets');
+    $this->assertXPath('//a[contains(@href, "/admin/modules/abonne/config/site/type_module/abonne")]'
+                       .'[contains(@href, "/action1/prets")]');
+  }
+
+
+  /** @test */
+  public function intonationPageShouldContainsLinkToEditAccountConfig() {
+    $this->_buildTemplateProfil(['id' => 200]);
+    $this->dispatch('/abonne/prets');
+    $this->assertXPath('//a[contains(@href, "/admin/widget/edit-action/id/abonne_fiche")]');
+  }
+}
diff --git a/tests/application/modules/opac/controllers/BibControllerBibViewTest.php b/tests/application/modules/opac/controllers/BibControllerBibViewTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..b2048b05a8cc8d2c400f11deee8823f77b289cc6
--- /dev/null
+++ b/tests/application/modules/opac/controllers/BibControllerBibViewTest.php
@@ -0,0 +1,959 @@
+<?php
+/**
+ * Copyright (c) 2012-2021, 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 BibControllerBibViewInexistantTest extends AbstractControllerTestCase {
+  protected $_storm_default_to_volatile = true;
+
+  /** @test */
+  public function responseShouldRedirectToIndex() {
+    $this->dispatch('bib/bibview/');
+    $this->assertRedirectTo('/opac/bib/index');
+  }
+}
+
+
+
+
+abstract class BibControllerBibViewTestCase extends AbstractControllerTestCase {
+  protected
+    $_mock_sql,
+    $_storm_default_to_volatile = true;
+
+  public function setUp() {
+    parent::setUp();
+    unset($_REQUEST['geo_zone']);
+
+    $this->_mock_sql = $this->mock();
+    Zend_Registry::set('sql', $this->_mock_sql);
+
+
+    $this->bib_annecy = $this->fixture('Class_Bib', ['id' => 4,
+                                                     'id_zone' => 1,
+                                                     'libelle' => 'Annecy',
+                                                     'aff_zone' => '',
+                                                     'ville' => 'Annecy',
+                                                     'url_web' => 'http://www.annecy.fr',
+                                                     'mail' => 'jp@annecy.com',
+                                                     'telephone' => '04 50 51 32 12',
+                                                     'adresse' => '1 rue Jean Jaures',
+                                                     'photo' => '/userfiles/photobib/photobib4.jpg',
+                                                     'visibilite' => Class_Bib::V_DATA,
+                                                     'fond' => 'Tous les documents',
+                                                     'rewrite_url' => 'annecy']);
+
+    $this->bib_nozone = $this->fixture('Class_Bib', ['id' => 22,
+                                                     'id_zone' => 100,
+                                                     'libelle' => 'NoZone',
+                                                     'aff_zone' => '',
+                                                     'ville' => 'No Zone',
+                                                     'url_web' => 'http://www.nozone.fr',
+                                                     'mail' => 'mail@nozone.com',
+                                                     'telephone' => '04 50 51 32 12',
+                                                     'adresse' => '1 rue Jean Jaures',
+                                                     'visibilite' => Class_Bib::V_DATA]);
+
+    $this->haute_savoie = $this->fixture('Class_Zone', ['id' => 1,
+                                                        'libelle' => 'Haute-Savoie',
+                                                        'couleur_texte' => '#059',
+                                                        'couleur_ombre' => '#234',
+                                                        'taille_fonte' => '14',
+                                                        'image' => 'carte_74.png',
+                                                        'bibs' => [$this->bib_annecy]]);
+
+    $ecrivez_des_tests = $this->fixture('Class_Article', ['id' => 2,
+                                                          'id_site' => 0,
+                                                          'titre' => 'Ecrivez des tests !',
+                                                          'contenu' => 'Ça fera le plus grand bien',
+                                                          'categorie' => $this->fixture('Class_ArticleCategorie',
+                                                                                        ['id' => 5,
+                                                                                         'id_site' => 4,
+                                                                                         'libelle' => 'Bonnes pratiques'])]);
+
+    ZendAfi_View_Helper_NewsBibHelper::setTimeSource(new TimeSourceForTest('2016-07-14 22:22:22'));
+
+    $this->onLoaderOfModel('Class_Article')
+         ->whenCalled('getArticlesByPreferences')
+         ->with(['id_bib' => '4',
+                 'events_only' => true,
+                 'display_order' => 'EventDebut',
+                 'event_end_after' => '2016-07-14'])
+         ->answers([$ecrivez_des_tests])
+
+         ->whenCalled('getArticlesByPreferences')
+         ->with(['id_bib' => '4'])
+         ->answers([$ecrivez_des_tests])
+
+
+         ->whenCalled('getArticlesByPreferences')
+         ->with(['id_bib' => '22',
+                 'events_only' => true,
+                 'display_order' => 'EventDebut',
+                 'event_end_after' => '2016-07-14'])
+         ->answers([$ecrivez_des_tests])
+
+         ->whenCalled('getArticlesByPreferences')
+         ->with(['id_bib' => '22'])
+         ->answers([$ecrivez_des_tests])
+
+
+         ->whenCalled('filterByLocaleAndWorkflow')
+         ->with([$ecrivez_des_tests])
+         ->answers([$ecrivez_des_tests]);
+
+    $this->onLoaderOfModel('Class_Exemplaire')
+         ->whenCalled('countBy')
+         ->with(['model' => $this->bib_annecy, 'role' => 'bib'])
+         ->answers(20)
+
+         ->whenCalled('countBy')
+         ->with(['model' => $this->bib_nozone, 'role' => 'bib'])
+         ->answers(20)
+
+         ->whenCalled('countBy')
+         ->with([])
+         ->answers(20)
+
+         ->beStrict();
+
+    $this->_mock_sql
+      ->whenCalled('fetchOne')
+      ->answers('');
+  }
+
+
+  public function tearDown() {
+    Class_Ouverture_Visitor::setTimeSource(null);
+    ZendAfi_View_Helper_NewsBibHelper::setTimeSource(null);
+    parent::tearDown();
+  }
+}
+
+
+
+
+class BibControllerBibViewOnlyAfternoonAnnecyNotLoggedTest extends BibControllerBibViewTestCase {
+  public function setUp() {
+    parent::setUp();
+    ZendAfi_Auth::getInstance()->clearIdentity();
+    Class_Ouverture_Visitor::setTimeSource(new TimeSourceForTest('2016-06-24 08:08:42'));
+
+
+    $this->fixture('Class_Ouverture',
+                   ['id' => 21,
+                    'id_site' => 4,
+                    'label' => 'Horaires réduits',
+                    'jour_semaine' => Class_Ouverture::MARDI,
+                    'debut_matin' => '00:00',
+                    'fin_matin' => '00:00',
+                    'debut_apres_midi' => '15:00',
+                    'fin_apres_midi' => '17:00',
+                   ]);
+
+
+    Class_bib::find(4)
+      ->setHoraire('  ');
+
+    $this->dispatch('bib/bibview/id/4', true);
+  }
+
+
+  public function tearDown() {
+    Class_Ouverture_Visitor::setTimeSource(null);
+    parent::tearDown();
+  }
+
+
+  /** @test */
+  public function openingsShouldContainsDefaultOpening() {
+    $this->assertXPathContentContains('//div[contains(@class, "library_schedule")]//dd',
+                                      'Mardi : 15h - 17h', $this->_response->getBody());
+  }
+}
+
+
+
+
+class BibControllerBibViewAnnecyNotLoggedTest extends BibControllerBibViewTestCase {
+  public function setUp() {
+    parent::setUp();
+    ZendAfi_Auth::getInstance()->clearIdentity();
+    Class_Ouverture_Visitor::setTimeSource(new TimeSourceForTest('2016-06-24 08:08:42'));
+
+    $this->fixture('Class_Ouverture',
+                   ['id' => 1,
+                    'id_site' => 4,
+                    'jour_semaine' => Class_Ouverture::LUNDI]);
+
+    $this->fixture('Class_Ouverture',
+                   ['id' => 20,
+                    'id_site' => 4,
+                    'jour_semaine' => Class_Ouverture::MARDI]);
+
+
+    $this->fixture('Class_Ouverture',
+                   ['id' => 21,
+                    'id_site' => 4,
+                    'label' => 'Horaires réduits',
+                    'jour_semaine' => Class_Ouverture::MARDI,
+                    'debut_matin' => '00:00',
+                    'fin_matin' => '00:00',
+                    'debut_apres_midi' => '15:00',
+                    'fin_apres_midi' => '17:00',
+                    'validity_start' => '2016-07-01',
+                    'validity_end' => '2016-07-20']);
+
+
+    $this->fixture('Class_Ouverture',
+                   ['id' => 2,
+                    'id_site' => 4,
+                    'jour_semaine' => Class_Ouverture::LUNDI,
+                    'validity_start' => '2016-07-01',
+                    'validity_end' => '2016-08-31']);
+
+    $this->fixture('Class_Ouverture',
+                   ['id' => 3,
+                    'id_site' => 4,
+                    'jour' => '2016-07-01']);
+
+    // too far away
+    $this->fixture('Class_Ouverture',
+                   ['id' => 4,
+                    'id_site' => 4,
+                    'jour_semaine' => Class_Ouverture::LUNDI,
+                    'validity_start' => '2020-06-31',
+                    'validity_end' => '2020-08-31']);
+
+    $this->fixture('Class_Ouverture',
+                   ['id' => 5,
+                    'id_site' => 4,
+                    'jour_semaine' => Class_Ouverture::LUNDI,
+                    'validity_start' => '2016-07-02',
+                    'validity_end' => '2016-07-03']);
+
+    $this->fixture('Class_Ouverture',
+                   ['id' => 6,
+                    'id_site' => 4,
+                    'jour' => '2016-06-12']);
+
+    // past
+    $this->fixture('Class_Ouverture',
+                   ['id' => 7,
+                    'id_site' => 4,
+                    'jour' => '2016-06-26',
+                    'debut_matin' => '00:00',
+                    'fin_matin' => '00:00',
+                    'debut_apres_midi' => '00:00',
+                    'fin_apres_midi' => '00:00']);
+
+    // multimedia dedicated
+    $this->fixture('Class_Ouverture',
+                   ['id' => 8,
+                    'id_site' => 4,
+                    'jour' => '2016-07-07',
+                    'used_for' => Class_Ouverture::USED_FOR_MULTIMEDIA]);
+
+    $this->dispatch('bib/bibview/id/4', true);
+  }
+
+
+  /** @test */
+  public function formRechercheShouldLinkToCurrentBib() {
+    $this->assertXPath('//form[contains(@action, "/recherche/simple/id/4/geo_bib/4")]');
+  }
+
+
+  /** @test */
+  public function fondsShouldDisplayTousLesDocuments() {
+    $this->assertXPathContentContains('//div[@class="library_fonds library_box"]/dl[preceding-sibling::h2[text()="Fonds"]]/dd',
+                                      'Tous les documents');
+  }
+
+
+  /** @test */
+  public function adresseShouldBe1RueJeanJaures() {
+    $this->assertXPathContentContains('//dd', '1 rue Jean Jaures');
+  }
+
+
+  /** @test */
+  public function photoBibShouldBeDisplayedWithClassBibviewImage() {
+    $this->assertXPath('//img[@class="bibview_image"][@src="'. BASE_URL .'/userfiles/photobib/photobib4.jpg"]');
+  }
+
+
+  /** @test */
+  public function articleEcrivezDesTestsShouldBeVisible() {
+    $this->assertXPathContentContains('//article//header//a[contains(@href, "/cms/articleview/id/2")]',
+                                      'Ecrivez des tests !');
+  }
+
+
+  /** @test */
+  public function articleEcrivezDesTestsShouldContainsHeaderSpan() {
+    $this->assertXPathContentContains('//article//header//span',
+                                      'Annecy');
+  }
+
+
+  /** @test */
+  public function libelleCatBonnesPratiquesShouldBeVisible() {
+    $this->assertXPathContentContains('//h2',
+                                      'Bonnes pratiques');
+  }
+
+
+  /** @test */
+  public function urlRetourShouldBeZoneViewIdOne() {
+    $this->assertXPathContentContains('//a[contains(@href, "/bib/zoneview/id/1")]',
+                                      'Retour');
+  }
+
+
+  /** @test */
+  public function openingsShouldContainsDefaultOpening() {
+    $this->assertXPathContentContains('//div[contains(@class, "library_schedule")]//dd',
+                                      'Lundi : 10h - 18h');
+  }
+
+
+  /** @test */
+  public function openingsShouldContainsPeriodLabel() {
+    $this->assertXPathContentContains('//div[contains(@class, "library_schedule")]//h3',
+                                      'du vendredi 01 juillet au mercredi 31 août 2016');
+  }
+
+
+  /** @test */
+  public function openingsShouldContainsSecondPeriodLabel() {
+    $this->assertXPathContentContains('//div[contains(@class, "library_schedule")]//h3',
+                                      'du samedi 02 au dimanche 03 juillet 2016');
+  }
+
+
+  /** @test */
+  public function openingsShouldContainsHorairesReduits() {
+    $this->assertXPathContentContains('//div[contains(@class, "library_schedule")]//h3',
+                                      'Horaires réduits du vendredi 01 au mercredi 20 juillet 2016');
+  }
+
+
+  /** @test */
+  public function openingsShouldNotContainsTooFarPeriodLabel() {
+    $this->assertNotXPathContentContains('//div[contains(@class, "library_schedule")]//h3',
+                                         'du mercredi 01 juillet au lundi 31 août 2020');
+  }
+
+
+  /** @test */
+  public function openingsShouldContainsExceptionnalLabel() {
+    $this->assertXPathContentContains('//div[contains(@class, "library_schedule")]//h3',
+                                      'Ouverture exceptionnelle');
+  }
+
+
+  /** @test */
+  public function openingsShouldContainsExceptionnalDate() {
+    $this->assertXPathContentContains('//div[contains(@class, "library_schedule")]//li',
+                                      'le vendredi 01 juillet : 10h - 18h');
+  }
+
+
+  /** @test */
+  public function openingsShouldNotContainsMultimediaDate() {
+    $this->assertNotXPathContentContains('//div[contains(@class, "library_schedule")]//li',
+                                         'le jeudi 07 juillet : 10h - 18h');
+  }
+
+
+  /** @test */
+  public function openingsShouldNotContainsPastExceptionnalDate() {
+    $this->assertNotXPathContentContains('//div[contains(@class, "library_schedule")]//li',
+                                         'le dimanche 12 juin : 10h - 18h');
+  }
+
+
+  /** @test */
+  public function openingsShouldContainsClosureLabel() {
+    $this->assertXPathContentContains('//div[contains(@class, "library_schedule")]//h3',
+                                      'Fermeture exceptionnelle');
+  }
+
+
+  /** @test */
+  public function openingsShouldContainsClosureDate() {
+    $this->assertXPathContentContains('//div[contains(@class, "library_schedule")]//li',
+                                      'le dimanche 26 juin');
+  }
+
+
+  /** @test */
+  public function editBibShouldNotBePresent() {
+    $this->assertNotXPath('//a[contains(@href, "/admin/bib/edit/id/")]');
+  }
+
+
+  /** @test */
+  public function editOpeningsShouldNotBePresent() {
+    $this->assertNotXPath('//a[contains(@href, "/admin/ouvertures/index/id_site/")]');
+  }
+}
+
+
+
+
+class BibControllerBibViewLibraryOpeningClosedOnHolidaysTest extends BibControllerBibViewTestCase {
+
+  public function setUp() {
+    parent::setUp();
+    Class_Ouverture_Visitor::setTimeSource(new TimeSourceForTest('2018-12-14 11:00:00'));
+
+    $this->fixture('Class_Ouverture',
+                   ['id' => 200,
+                    'id_site' => 4,
+                    'jour_semaine' => Class_Ouverture::LUNDI,
+                    'label' => 'Horaires habituels']);
+
+    foreach(range(1, 7) as $day)
+      $this->fixture('Class_Ouverture',
+                     ['id' => 400 + $day,
+                      'horaires' => ['00:00', '00:00', '00:00', '00:00'],
+                      'jour' => '',
+                      'id_site' => 4,
+                      'validity_start' => '2018-12-23',
+                      'validity_end' => '2019-01-01',
+                      'jour_semaine' => $day]);
+  }
+
+
+  /** @test */
+  public function firstOpeningsH3ShouldContainsHorairesHabituels() {
+    $this->dispatch('bib/bibview/id/4', true);
+    $this->assertXPathContentContains('//li[1]/h3',
+                                      'Horaires habituels');
+  }
+
+
+  /** @test */
+  public function secondOpeningsH3ShouldContainsFermeturesVacances() {
+    Class_Ouverture::find(401)->setLabel('Fermetures vacances scolaires');
+    $this->dispatch('bib/bibview/id/4', true);
+
+    $this->assertXPathContentContains('//li[2]/h3',
+                                      'Fermetures vacances scolaires du dimanche 23 décembre 2018 au mardi 01 janvier 2019');
+  }
+
+
+  /** @test */
+  public function withoutLabelSecondOpeningsH3ShouldContainsFermetureExceptionnelle() {
+    $this->dispatch('bib/bibview/id/4', true);
+
+    $this->assertXPathContentContains('//li[2]/h3',
+                                      'Fermeture exceptionnelle du dimanche 23 décembre 2018 au mardi 01 janvier 2019');
+  }
+
+
+  /** @test */
+  public function secondOpeningsShouldNotContainsLundi() {
+    $this->dispatch('bib/bibview/id/4', true);
+    $this->assertNotXPathContentContains('//li[2]//li',
+                                         'Lundi');
+  }
+}
+
+
+
+class BibControllerBibViewAnnecyHideNewsTest extends BibControllerBibViewTestCase {
+  public function setUp() {
+    parent::setUp();
+    Class_Profil::getCurrentProfil()
+      ->setModulePreference('bib', 'bibview', 'hide_news', 1);
+
+    $this->dispatch('bib/bibview/id/4', true);
+  }
+
+
+  /** @test */
+  public function articleEcrivezDesTestsShouldNotBeVisible() {
+    $this->assertNotXPathContentContains('//article//header//a[contains(@href, "/cms/articleview/id/2")]',
+                                         'Ecrivez des tests !');
+  }
+}
+
+
+
+
+class BibControllerBibViewAnnecyByRewriteUrlTest extends BibControllerBibViewTestCase {
+  public function setUp() {
+    parent::setUp();
+    $this->dispatch('annecy', true);
+  }
+
+
+  /** @test */
+  public function h1ShouldContainsAnnecy() {
+    $this->assertXPathContentContains('//h1', 'Annecy');
+  }
+
+
+  /** @test */
+  public function controllerShouldBeBib() {
+    $this->assertController('bib');
+  }
+
+
+  /** @test */
+  public function actionShouldBeBibview() {
+    $this->assertAction('bibview');
+  }
+}
+
+
+
+
+class BibControllerBibViewAnnecyByRewriteUrlWithLinkToProfilTest
+  extends BibControllerBibViewTestCase {
+  public function setUp() {
+    parent::setUp();
+
+    $profil = $this->fixture('Class_Profil',
+                             ['id' => 78,
+                              'libelle' => 'Bienvenue à Annecy']);
+
+    $this->bib_annecy->setLinkToProfil($profil)->assertSave();
+    $this->dispatch('annecy', true);
+  }
+
+
+  /** @test */
+  public function controllerShouldBeIndex() {
+    $this->assertController('index');
+  }
+
+
+  /** @test */
+  public function actionShouldBeBibview() {
+    $this->assertAction('index');
+  }
+
+
+  /** @test */
+  public function currentProfilShouldBeSeventyHeight() {
+    $this->assertEquals(78, Class_Profil::getCurrentProfil()->getId());
+  }
+
+}
+
+
+
+abstract class BibControllerLibraryWithOpeningsTestCase extends BibControllerBibViewTestCase {
+  public function setUp() {
+    parent::setUp();
+
+    Class_Ouverture_Visitor::setTimeSource(new TimeSourceForTest('2016-07-01 08:08:42'));
+
+    $admin_bib = $this->fixture('Class_Users',
+                                ['id' => 54,
+                                 'login' => 'admin bib',
+                                 'password' => 'popup',
+                                 'id_site' => 4]);
+    $admin_bib->beAdminBib();
+    ZendAfi_Auth::getInstance()->logUser($admin_bib);
+
+    $this->fixture('Class_Ouverture',
+                   ['id' => 1,
+                    'id_site' => 4,
+                    'jour_semaine' => Class_Ouverture::LUNDI,
+                    'label' => 'D\'habitude']);
+
+    $this->fixture('Class_Ouverture',
+                   ['id' => 2,
+                    'id_site' => 4,
+                    'jour_semaine' => Class_Ouverture::LUNDI,
+                    'validity_start' => '2016-06-30',
+                    'validity_end' => '2016-08-31',
+                    'label' => 'Horaires d\'été']);
+
+    $this->fixture('Class_Ouverture',
+                   ['id' => 3,
+                    'id_site' => 4,
+                    'jour_semaine' => Class_Ouverture::MARDI,
+                    'validity_start' => '2016-06-30',
+                    'validity_end' => '2016-08-31',
+                    'label' => 'I will not be displayed']);
+
+    $this->fixture('Class_Ouverture',
+                   ['id' => 4,
+                    'id_site' => 4,
+                    'jour_semaine' => Class_Ouverture::MERCREDI,
+                    'validity_start' => '2016-06-30',
+                    'validity_end' => '2016-08-31',
+                    'label' => 'Me neither']);
+
+    $this->fixture('Class_Ouverture',
+                   ['id' => 5,
+                    'id_site' => 4,
+                    'jour' => '2016-07-14',
+                    'label' => 'C\'est la teuff']);
+
+    $this->fixture('Class_Ouverture',
+                   ['id' => 6,
+                    'id_site' => 4,
+                    'jour' => '2016-07-15',
+                    'debut_matin' => '00:00',
+                    'fin_matin' => '00:00',
+                    'debut_apres_midi' => '00:00',
+                    'fin_apres_midi' => '00:00',
+                    'label' => 'Repos']);
+  }
+}
+
+
+
+
+class BibControllerBibViewAnnecyRangeOpeningsTest extends BibControllerLibraryWithOpeningsTestCase {
+  public function setUp() {
+    parent::setUp();
+    $this->dispatch('bib/bibview/id/4', true);
+  }
+
+
+  public function tearDown() {
+    Class_Ouverture_Visitor::setTimeSource(null);
+    parent::tearDown();
+  }
+
+
+  /** @test */
+  public function shouldContainsDefault() {
+    $this->assertXPathContentContains('//div[contains(@class, "library_schedule")]//h3',
+                                      'D\'habitude',
+                                      $this->_response->getBody());
+  }
+
+
+  /** @test */
+  public function shouldContainsHorairesDEte() {
+    $this->assertXPathContentContains('//div[contains(@class, "library_schedule")]//h3',
+                                      'Horaires d\'été',
+                                      $this->_response->getBody());
+  }
+
+
+  /** @test */
+  public function openingsShouldContainsExceptionnalLabelTeuff() {
+    $this->assertXPathContentContains('//div[contains(@class, "library_schedule")]//li',
+                                      'C\'est la teuff ');
+  }
+
+
+  /** @test */
+  public function openingsShouldContainsExceptionnalLabelRepos() {
+    $this->assertXPathContentContains('//div[contains(@class, "library_schedule")]//li',
+                                      'Repos ');
+  }
+
+
+  /** @test */
+  public function editBibShouldBePresent() {
+    $this->assertXPath('//a[contains(@href,"admin/bib/edit/id/4")]');
+  }
+
+
+  /** @test */
+  public function editOpeningsShouldBePresent() {
+    $this->assertXPath('//a[contains(@href, "admin/ouvertures/index/id_site/4")]');
+  }
+}
+
+
+
+
+class BibControllerBibViewAnnecyWithOutdatedRangeOpeningsTest extends BibControllerBibViewTestCase {
+  public function setUp() {
+    parent::setUp();
+
+    Class_Ouverture_Visitor::setTimeSource(new TimeSourceForTest('2016-10-25 16:08:42'));
+
+    $admin_bib = $this->fixture('Class_Users',
+                                ['id' => 54,
+                                 'login' => 'admin bib',
+                                 'password' => 'popup',
+                                 'id_site' => 4]);
+    $admin_bib->beAdminBib();
+    ZendAfi_Auth::getInstance()->logUser($admin_bib);
+
+    $this->fixture('Class_Ouverture',
+                   ['id' => 1,
+                    'id_site' => 4,
+                    'jour_semaine' => Class_Ouverture::LUNDI,
+                    'label' => 'D\'habitude']);
+
+    $this->fixture('Class_Ouverture',
+                   ['id' => 2,
+                    'id_site' => 4,
+                    'jour_semaine' => Class_Ouverture::LUNDI,
+                    'validity_start' => '2016-06-30',
+                    'validity_end' => '2016-08-31',
+                    'label' => 'Horaires d\'été']);
+
+
+    $this->dispatch('bib/bibview/id/4', true);
+  }
+
+
+  public function tearDown() {
+    Class_Ouverture_Visitor::setTimeSource(null);
+    parent::tearDown();
+  }
+
+
+  /** @test */
+  public function shouldContainsDefault() {
+    $this->assertXPathContentContains('//div[contains(@class, "library_schedule")]//h3',
+                                      'D\'habitude');
+  }
+
+
+  /** @test */
+  public function shouldNotContainsHorairesDEte() {
+    $this->assertNotXPathContentContains('//div[contains(@class, "library_schedule")]//h3',
+                                         'Horaires d\'été',
+                                         $this->_response->getBody());
+  }
+}
+
+
+
+class BibControllerBibViewAnnecyFreeTextOpeningsTest extends BibControllerBibViewTestCase {
+  public function setUp() {
+    parent::setUp();
+
+    Class_Ouverture_Visitor::setTimeSource(new TimeSourceForTest('2016-07-01 08:08:42'));
+
+    $admin_bib = $this->fixture('Class_Users',
+                                ['id' => 54,
+                                 'login' => 'admin bib',
+                                 'password' => 'popup',
+                                 'id_site' => 4]);
+    $admin_bib->beAdminBib();
+    ZendAfi_Auth::getInstance()->logUser($admin_bib);
+
+    $this->fixture('Class_Ouverture',
+                   ['id' => 1,
+                    'id_site' => 4,
+                    'jour_semaine' => Class_Ouverture::LUNDI,
+                    'label' => 'D\'habitude']);
+
+    $this->bib_annecy
+      ->setHoraire('Fermé pour travaux')
+      ->assertSave();
+
+    $this->dispatch('bib/bibview/id/4', true);
+  }
+
+
+  public function tearDown() {
+    Class_Ouverture_Visitor::setTimeSource(null);
+    parent::tearDown();
+  }
+
+
+  /** @test */
+  public function shouldNotContainsDefaultOpenings() {
+    $this->assertNotXPathContentContains('//div[contains(@class, "library_schedule")]//h3',
+                                         'D\'habitude',
+                                         $this->_response->getBody());
+  }
+
+
+  /** @test */
+  public function editOpeningsShouldNotBePresent() {
+    $this->assertNotXPath('//a[contains(@href, "admin/ouvertures/index/id_site/4")]');
+  }
+}
+
+
+
+class BibControllerBibViewBackUrlTest extends BibControllerBibViewTestCase {
+
+  public function setUp() {
+    parent::setUp();
+    $_SERVER['HTTP_REFERER'] = '/link/to/referer';
+  }
+
+
+  /** @test */
+  public function backUrlShouldBeZoneView() {
+    $this->dispatch('bib/bibview/id/4', true);
+    $this->assertXPathContentContains('//div[@class="back_link"]/a[contains(@href, "zoneview/id/1")]', 'Retour');
+  }
+
+
+  /** @test */
+  public function backUrlShouldBeReferer() {
+    $this->dispatch('bib/bibview/id/22', true);
+    $this->assertXPathContentContains('//div[@class="back_link"]/a[contains(@href, "/link/to/referer")]', 'Retour');
+  }
+}
+
+
+
+class BibControllerBibViewTextCustomFieldsTest extends BibControllerBibViewTestCase {
+  public function setUp() {
+    parent::setUp();
+    $this->custom_field = $this->fixture('Class_CustomField',
+                                          ['id' => 5,
+                                           'priority' => 3,
+                                           'field_type' => Class_CustomField_Meta::TEXT_INPUT,
+                                           'label' => 'Lieu',
+                                           'model' => 'Bib']);
+  }
+
+
+  /** @test */
+  public function customFieldLieuShouldBeDisplayed() {
+    $this->bib_annecy->setCustomField('Lieu', 'Far Far Away');
+    $this->bib_annecy->saveWithCustomFields();
+    $this->dispatch('bib/bibview/id/4', true);
+    $this->assertXPathContentContains("//div//dt", "Lieu", $this->_response->getBody());
+  }
+
+
+  /** @test */
+  public function customFieldValueShouldBeFarFarAway() {
+    $this->bib_annecy->setCustomField('Lieu', 'Far Far Away');
+    $this->bib_annecy->saveWithCustomFields();
+    $this->dispatch('bib/bibview/id/4', true);
+    $this->assertXPathContentContains("//div//dd", "Far Far Away", $this->_response->getBody());
+  }
+
+
+  /** @test */
+  public function customFieldLieuShouldNotBeDisplayed() {
+    $this->bib_annecy->setCustomField('Lieu', '');
+    $this->bib_annecy->saveWithCustomFields();
+    $this->dispatch('bib/bibview/id/4', true);
+    $this->assertNotXPathContentContains("//div//dd", "Lieu", $this->_response->getBody());
+  }
+}
+
+
+
+
+class BibControllerBibViewMultiCheckBoxCustomFieldsTest extends BibControllerBibViewTestCase {
+  public function setUp() {
+    parent::setUp();
+
+    $this->custom_field = $this->fixture('Class_CustomField',
+                                          ['id' => 2,
+                                           'priority' => 3,
+                                           'field_type' => Class_CustomField_Meta::SELECT,
+                                           'label' => 'Mode',
+                                           'options_list' => 'Expert;Novice',
+                                           'model' => 'Bib']);
+
+
+    $this->custom_field = $this->fixture('Class_CustomField',
+                                          ['id' => 12,
+                                           'priority' => 3,
+                                           'label' => 'Services',
+                                           'options_list' => 'Wifi;Projection;Restauration;l\'Médias',
+                                           'field_type' => Class_CustomField_Meta::MULTI_CHECKBOX,
+                                           'model' => 'Bib']);
+
+
+
+
+    $this->bib_annecy->setCustomField('Services', ['Wifi', 'Restauration','l\'Médias']);
+    $this->bib_annecy->saveWithCustomFields();
+    $this->dispatch('bib/bibview/id/4', true);
+
+  }
+
+
+  /** @test */
+  public function customFieldServicesShouldBeDisplayed() {
+    $this->assertXPathContentContains("//div//h2", "Services");
+  }
+
+
+  /** @test */
+  public function servicesShouldContainsWifi() {
+    $this->assertXPathContentContains('//div[@class="custom1 library_box"]//dd', 'Wifi',$this->_response->getBody());
+  }
+
+
+  /** @test */
+  public function servicesShouldContainsRestauration() {
+    $this->assertXPathContentContains('//div//dd[@class="restauration"]', 'Restauration',$this->_response->getBody());
+  }
+
+
+  /** @test */
+  public function classShouldBeNameWithoutAccents() {
+    $this->assertXPathContentContains('//div//dd[@class="l_medias"]', 'l\'Médias',$this->_response->getBody());
+  }
+
+
+  /** @test */
+  public function servicesShouldNotContainsProjection() {
+    $this->assertNotXPathContentContains('//div//dd', 'Projection');
+  }
+
+
+  /** @test */
+  public function servicesShouldNotContainsSeparator() {
+    $this->assertNotXPathContentContains('//div//dd', 'Wifi;Restauration');
+  }
+}
+
+
+
+
+class BibControllerBibViewAnnecyWithParamRetourHistoriqueTest extends BibControllerBibViewTestCase {
+  /** @test */
+  public function withUrlRetourCmsArticleViewFiveShouldBeAccepted() {
+    $this->dispatch('bib/bibview/id/4?retour=cms+articleview+5');
+    $this->assertXPathContentContains('//a[contains(@href, "/cms/articleview/id/5")]',
+                                      'Retour');
+  }
+
+  /** @test */
+  public function withUrlRetourCmsOnlyShouldNotBeAccepted() {
+    $this->dispatch('bib/bibview/id/4?retour=cms');
+    $this->assertXPathContentContains('//a[contains(@href, "/bib/zoneview/id/1")]',
+                                      'Retour');
+  }
+}
+
+
+
+
+class BibControllerBibViewAnnecyEditActionConfigTest extends BibControllerBibViewTestCase {
+  /** @test */
+  public function editActionConfigShouldBePresent() {
+    $this->dispatch('/bib/bibview/id/4');
+    $this->assertXPath('//a[contains(@href, "/admin/modules/bib/config/site/type_module/bib")]'
+                       . '[contains(@href, "/action1/bibview")]');
+  }
+}
\ No newline at end of file
diff --git a/tests/application/modules/opac/controllers/BibControllerTest.php b/tests/application/modules/opac/controllers/BibControllerTest.php
index 86cab05b7aff7b736225d1d643dafd8a2a4b4fb8..1dc49767ea688db923cde0c32c6f76b43f76c179 100644
--- a/tests/application/modules/opac/controllers/BibControllerTest.php
+++ b/tests/application/modules/opac/controllers/BibControllerTest.php
@@ -366,573 +366,6 @@ class BibControllerMapZoneViewWithoutProfilTest extends BibControllerMapViewTest
 
 
 
-abstract class BibControllerBibViewTestCase extends BibControllerWithZoneTestCase {
-  protected
-    $_mock_sql,
-    $_storm_default_to_volatile = true;
-
-  public function setUp() {
-    parent::setUp();
-
-    $this->_mock_sql = Storm_Test_ObjectWrapper::mock();
-    Zend_Registry::set('sql', $this->_mock_sql);
-
-    $this->onLoaderOfModel('Class_Exemplaire')
-      ->whenCalled('countBy')
-      ->with(['model' => $this->bib_annecy, 'role' => 'bib'])
-      ->answers(20)
-
-      ->whenCalled('countBy')
-      ->with(['model' => $this->bib_nozone, 'role' => 'bib'])
-      ->answers(20)
-
-      ->whenCalled('countBy')
-      ->with([])
-      ->answers(20)
-
-      ->beStrict();
-
-    $this->_mock_sql
-      ->whenCalled('fetchOne')
-      ->answers('');
-  }
-}
-
-
-
-
-class BibControllerBibViewOnlyAfternoonAnnecyTest extends BibControllerBibViewTestCase {
-  public function setUp() {
-    parent::setUp();
-    ZendAfi_Auth::getInstance()->clearIdentity();
-    Class_Ouverture_Visitor::setTimeSource(new TimeSourceForTest('2016-06-24 08:08:42'));
-
-
-    $this->fixture('Class_Ouverture',
-                   ['id' => 21,
-                    'id_site' => 4,
-                    'label' => 'Horaires réduits',
-                    'jour_semaine' => Class_Ouverture::MARDI,
-                    'debut_matin' => '00:00',
-                    'fin_matin' => '00:00',
-                    'debut_apres_midi' => '15:00',
-                    'fin_apres_midi' => '17:00',
-                   ]);
-
-
-    Class_bib::find(4)
-      ->setHoraire('  ');
-
-    $this->dispatch('bib/bibview/id/4', true);
-  }
-
-
-  public function tearDown() {
-    Class_Ouverture_Visitor::setTimeSource(null);
-    parent::tearDown();
-  }
-
-
-  /** @test */
-  public function openingsShouldContainsDefaultOpening() {
-    $this->assertXPathContentContains('//div[contains(@class, "library_schedule")]//dd',
-                                      'Mardi : 15h - 17h', $this->_response->getBody());
-  }
-}
-
-
-
-
-class BibControllerBibViewAnnecyTest extends BibControllerBibViewTestCase {
-  public function setUp() {
-    parent::setUp();
-    ZendAfi_Auth::getInstance()->clearIdentity();
-    Class_Ouverture_Visitor::setTimeSource(new TimeSourceForTest('2016-06-24 08:08:42'));
-
-    $this->fixture('Class_Ouverture',
-                   ['id' => 1,
-                    'id_site' => 4,
-                    'jour_semaine' => Class_Ouverture::LUNDI]);
-
-    $this->fixture('Class_Ouverture',
-                   ['id' => 20,
-                    'id_site' => 4,
-                    'jour_semaine' => Class_Ouverture::MARDI]);
-
-
-    $this->fixture('Class_Ouverture',
-                   ['id' => 21,
-                    'id_site' => 4,
-                    'label' => 'Horaires réduits',
-                    'jour_semaine' => Class_Ouverture::MARDI,
-                    'debut_matin' => '00:00',
-                    'fin_matin' => '00:00',
-                    'debut_apres_midi' => '15:00',
-                    'fin_apres_midi' => '17:00',
-                    'validity_start' => '2016-07-01',
-                    'validity_end' => '2016-07-20']);
-
-
-    $this->fixture('Class_Ouverture',
-                   ['id' => 2,
-                    'id_site' => 4,
-                    'jour_semaine' => Class_Ouverture::LUNDI,
-                    'validity_start' => '2016-07-01',
-                    'validity_end' => '2016-08-31']);
-
-    $this->fixture('Class_Ouverture',
-                   ['id' => 3,
-                    'id_site' => 4,
-                    'jour' => '2016-07-01']);
-
-    // too far away
-    $this->fixture('Class_Ouverture',
-                   ['id' => 4,
-                    'id_site' => 4,
-                    'jour_semaine' => Class_Ouverture::LUNDI,
-                    'validity_start' => '2020-06-31',
-                    'validity_end' => '2020-08-31']);
-
-    $this->fixture('Class_Ouverture',
-                   ['id' => 5,
-                    'id_site' => 4,
-                    'jour_semaine' => Class_Ouverture::LUNDI,
-                    'validity_start' => '2016-07-02',
-                    'validity_end' => '2016-07-03']);
-
-    $this->fixture('Class_Ouverture',
-                   ['id' => 6,
-                    'id_site' => 4,
-                    'jour' => '2016-06-12']);
-
-    // past
-    $this->fixture('Class_Ouverture',
-                   ['id' => 7,
-                    'id_site' => 4,
-                    'jour' => '2016-06-26',
-                    'debut_matin' => '00:00',
-                    'fin_matin' => '00:00',
-                    'debut_apres_midi' => '00:00',
-                    'fin_apres_midi' => '00:00']);
-
-    // multimedia dedicated
-    $this->fixture('Class_Ouverture',
-                   ['id' => 8,
-                    'id_site' => 4,
-                    'jour' => '2016-07-07',
-                    'used_for' => Class_Ouverture::USED_FOR_MULTIMEDIA]);
-
-    $this->dispatch('bib/bibview/id/4', true);
-  }
-
-
-  /** @test */
-  public function formRechercheShouldLinkToCurrentBib() {
-    $this->assertXPath('//form[contains(@action, "/recherche/simple/id/4/geo_bib/4")]');
-  }
-
-
-  /** @test */
-  public function fondsShouldDisplayTousLesDocuments() {
-    $this->assertXPathContentContains('//div[@class="library_fonds library_box"]/dl[preceding-sibling::h2[text()="Fonds"]]/dd',
-                                      'Tous les documents');
-  }
-
-
-  /** @test */
-  public function adresseShouldBe1RueJeanJaures() {
-    $this->assertXPathContentContains('//dd', '1 rue Jean Jaures');
-  }
-
-
-  /** @test */
-  public function photoBibShouldBeDisplayedWithClassBibviewImage() {
-    $this->assertXPath('//img[@class="bibview_image"][@src="'. BASE_URL .'/userfiles/photobib/photobib4.jpg"]');
-  }
-
-
-  /** @test */
-  public function articleEcrivezDesTestsShouldBeVisible() {
-    $this->assertXPathContentContains('//article//header//a[contains(@href, "/cms/articleview/id/2")]',
-                                      'Ecrivez des tests !');
-  }
-
-
-  /** @test */
-  public function articleEcrivezDesTestsShouldContainsHeaderSpan() {
-    $this->assertXPathContentContains('//article//header//span',
-                                      'Annecy');
-  }
-
-
-  /** @test */
-  public function libelleCatBonnesPratiquesShouldBeVisible() {
-    $this->assertXPathContentContains('//h2',
-                                      'Bonnes pratiques');
-  }
-
-
-  /** @test */
-  public function urlRetourShouldBeZoneViewIdOne() {
-    $this->assertXPathContentContains('//a[contains(@href, "/bib/zoneview/id/1")]',
-                                      'Retour');
-  }
-
-
-  /** @test */
-  public function openingsShouldContainsDefaultOpening() {
-    $this->assertXPathContentContains('//div[contains(@class, "library_schedule")]//dd',
-                                      'Lundi : 10h - 18h');
-  }
-
-
-  /** @test */
-  public function openingsShouldContainsPeriodLabel() {
-    $this->assertXPathContentContains('//div[contains(@class, "library_schedule")]//h3',
-                                      'du vendredi 01 juillet au mercredi 31 août 2016');
-  }
-
-
-  /** @test */
-  public function openingsShouldContainsSecondPeriodLabel() {
-    $this->assertXPathContentContains('//div[contains(@class, "library_schedule")]//h3',
-                                      'du samedi 02 au dimanche 03 juillet 2016');
-  }
-
-
-  /** @test */
-  public function openingsShouldContainsHorairesReduits() {
-    $this->assertXPathContentContains('//div[contains(@class, "library_schedule")]//h3',
-                                      'Horaires réduits du vendredi 01 au mercredi 20 juillet 2016');
-  }
-
-
-  /** @test */
-  public function openingsShouldNotContainsTooFarPeriodLabel() {
-    $this->assertNotXPathContentContains('//div[contains(@class, "library_schedule")]//h3',
-                                         'du mercredi 01 juillet au lundi 31 août 2020');
-  }
-
-
-  /** @test */
-  public function openingsShouldContainsExceptionnalLabel() {
-    $this->assertXPathContentContains('//div[contains(@class, "library_schedule")]//h3',
-                                      'Ouverture exceptionnelle');
-  }
-
-
-  /** @test */
-  public function openingsShouldContainsExceptionnalDate() {
-    $this->assertXPathContentContains('//div[contains(@class, "library_schedule")]//li',
-                                      'le vendredi 01 juillet : 10h - 18h');
-  }
-
-
-  /** @test */
-  public function openingsShouldNotContainsMultimediaDate() {
-    $this->assertNotXPathContentContains('//div[contains(@class, "library_schedule")]//li',
-                                         'le jeudi 07 juillet : 10h - 18h');
-  }
-
-
-  /** @test */
-  public function openingsShouldNotContainsPastExceptionnalDate() {
-    $this->assertNotXPathContentContains('//div[contains(@class, "library_schedule")]//li',
-                                         'le dimanche 12 juin : 10h - 18h');
-  }
-
-
-  /** @test */
-  public function openingsShouldContainsClosureLabel() {
-    $this->assertXPathContentContains('//div[contains(@class, "library_schedule")]//h3',
-                                      'Fermeture exceptionnelle');
-  }
-
-
-  /** @test */
-  public function openingsShouldContainsClosureDate() {
-    $this->assertXPathContentContains('//div[contains(@class, "library_schedule")]//li',
-                                      'le dimanche 26 juin');
-  }
-
-
-  /** @test */
-  public function editBibShouldNotBePresent() {
-    $this->assertNotXPath('//a[contains(@href, "/admin/bib/edit/id/")]');
-  }
-
-
-  /** @test */
-  public function editOpeningsShouldNotBePresent() {
-    $this->assertNotXPath('//a[contains(@href, "/admin/ouvertures/index/id_site/")]');
-  }
-}
-
-
-
-
-class ZendAfi_View_Helper_RenderLibraryOpeningClosedOnHolidaysTestTest extends BibControllerBibViewTestCase {
-
-  public function setUp() {
-    parent::setUp();
-    Class_Ouverture_Visitor::setTimeSource(new TimeSourceForTest('2018-12-14 11:00:00'));
-
-    $this->fixture('Class_Ouverture',
-                   ['id' => 200,
-                    'id_site' => 4,
-                    'jour_semaine' => Class_Ouverture::LUNDI,
-                    'label' => 'Horaires habituels']);
-
-    foreach(range(1, 7) as $day)
-      $this->fixture('Class_Ouverture',
-                     ['id' => 400 + $day,
-                      'horaires' => ['00:00', '00:00', '00:00', '00:00'],
-                      'jour' => '',
-                      'id_site' => 4,
-                      'validity_start' => '2018-12-23',
-                      'validity_end' => '2019-01-01',
-                      'jour_semaine' => $day]);
-  }
-
-
-  /** @test */
-  public function firstOpeningsH3ShouldContainsHorairesHabituels() {
-    $this->dispatch('bib/bibview/id/4', true);
-    $this->assertXPathContentContains('//li[1]/h3',
-                                      'Horaires habituels');
-  }
-
-
-  /** @test */
-  public function secondOpeningsH3ShouldContainsFermeturesVacances() {
-    Class_Ouverture::find(401)->setLabel('Fermetures vacances scolaires');
-    $this->dispatch('bib/bibview/id/4', true);
-
-    $this->assertXPathContentContains('//li[2]/h3',
-                                      'Fermetures vacances scolaires du dimanche 23 décembre 2018 au mardi 01 janvier 2019');
-  }
-
-
-  /** @test */
-  public function withoutLabelSecondOpeningsH3ShouldContainsFermetureExceptionnelle() {
-    $this->dispatch('bib/bibview/id/4', true);
-
-    $this->assertXPathContentContains('//li[2]/h3',
-                                      'Fermeture exceptionnelle du dimanche 23 décembre 2018 au mardi 01 janvier 2019');
-  }
-
-
-  /** @test */
-  public function secondOpeningsShouldNotContainsLundi() {
-    $this->dispatch('bib/bibview/id/4', true);
-    $this->assertNotXPathContentContains('//li[2]//li',
-                                         'Lundi');
-  }
-}
-
-
-
-class BibControllerBibViewAnnecyHideNewsTest extends BibControllerBibViewTestCase {
-  public function setUp() {
-    parent::setUp();
-    Class_Profil::getCurrentProfil()
-      ->setModulePreference('bib', 'bibview', 'hide_news', 1);
-
-    $this->dispatch('bib/bibview/id/4', true);
-  }
-
-
-  /** @test */
-  public function articleEcrivezDesTestsShouldNotBeVisible() {
-    $this->assertNotXPathContentContains('//article//header//a[contains(@href, "/cms/articleview/id/2")]',
-                                         'Ecrivez des tests !');
-  }
-}
-
-
-
-
-class BibControllerBibViewAnnecyByRewriteUrlTest extends BibControllerBibViewTestCase {
-  public function setUp() {
-    parent::setUp();
-    $this->dispatch('annecy', true);
-  }
-
-
-  /** @test */
-  public function h1ShouldContainsAnnecy() {
-    $this->assertXPathContentContains('//h1', 'Annecy');
-  }
-
-
-  /** @test */
-  public function controllerShouldBeBib() {
-    $this->assertController('bib');
-  }
-
-
-  /** @test */
-  public function actionShouldBeBibview() {
-    $this->assertAction('bibview');
-  }
-}
-
-
-
-
-class BibControllerBibViewAnnecyByRewriteUrlWithLinkToProfilTest extends BibControllerBibViewTestCase {
-  public function setUp() {
-    parent::setUp();
-
-    $profil = $this->fixture('Class_Profil',
-                             ['id' => 78,
-                              'libelle' => 'Bienvenue à Annecy']);
-
-    $this->bib_annecy->setLinkToProfil($profil)->assertSave();
-    $this->dispatch('annecy', true);
-  }
-
-
-  /** @test */
-  public function controllerShouldBeIndex() {
-    $this->assertController('index');
-  }
-
-
-  /** @test */
-  public function actionShouldBeBibview() {
-    $this->assertAction('index');
-  }
-
-
-  /** @test */
-  public function currentProfilShouldBeSeventyHeight() {
-    $this->assertEquals(78, Class_Profil::getCurrentProfil()->getId());
-  }
-
-}
-
-
-
-abstract class BibControllerLibraryWithOpeningsTestCase extends BibControllerBibViewTestCase {
-  public function setUp() {
-    parent::setUp();
-
-    Class_Ouverture_Visitor::setTimeSource(new TimeSourceForTest('2016-07-01 08:08:42'));
-
-    $admin_bib = $this->fixture('Class_Users',
-                                ['id' => 54,
-                                 'login' => 'admin bib',
-                                 'password' => 'popup',
-                                 'id_site' => 4]);
-    $admin_bib->beAdminBib();
-    ZendAfi_Auth::getInstance()->logUser($admin_bib);
-
-    $this->fixture('Class_Ouverture',
-                   ['id' => 1,
-                    'id_site' => 4,
-                    'jour_semaine' => Class_Ouverture::LUNDI,
-                    'label' => 'D\'habitude']);
-
-    $this->fixture('Class_Ouverture',
-                   ['id' => 2,
-                    'id_site' => 4,
-                    'jour_semaine' => Class_Ouverture::LUNDI,
-                    'validity_start' => '2016-06-30',
-                    'validity_end' => '2016-08-31',
-                    'label' => 'Horaires d\'été']);
-
-    $this->fixture('Class_Ouverture',
-                   ['id' => 3,
-                    'id_site' => 4,
-                    'jour_semaine' => Class_Ouverture::MARDI,
-                    'validity_start' => '2016-06-30',
-                    'validity_end' => '2016-08-31',
-                    'label' => 'I will not be displayed']);
-
-    $this->fixture('Class_Ouverture',
-                   ['id' => 4,
-                    'id_site' => 4,
-                    'jour_semaine' => Class_Ouverture::MERCREDI,
-                    'validity_start' => '2016-06-30',
-                    'validity_end' => '2016-08-31',
-                    'label' => 'Me neither']);
-
-    $this->fixture('Class_Ouverture',
-                   ['id' => 5,
-                    'id_site' => 4,
-                    'jour' => '2016-07-14',
-                    'label' => 'C\'est la teuff']);
-
-    $this->fixture('Class_Ouverture',
-                   ['id' => 6,
-                    'id_site' => 4,
-                    'jour' => '2016-07-15',
-                    'debut_matin' => '00:00',
-                    'fin_matin' => '00:00',
-                    'debut_apres_midi' => '00:00',
-                    'fin_apres_midi' => '00:00',
-                    'label' => 'Repos']);
-  }
-}
-
-
-
-
-class BibControllerBibViewAnnecyRangeOpeningsTest extends BibControllerLibraryWithOpeningsTestCase {
-  public function setUp() {
-    parent::setUp();
-    $this->dispatch('bib/bibview/id/4', true);
-  }
-
-
-  public function tearDown() {
-    Class_Ouverture_Visitor::setTimeSource(null);
-    parent::tearDown();
-  }
-
-
-  /** @test */
-  public function shouldContainsDefault() {
-    $this->assertXPathContentContains('//div[contains(@class, "library_schedule")]//h3',
-                                      'D\'habitude',
-                                      $this->_response->getBody());
-  }
-
-
-  /** @test */
-  public function shouldContainsHorairesDEte() {
-    $this->assertXPathContentContains('//div[contains(@class, "library_schedule")]//h3',
-                                      'Horaires d\'été',
-                                      $this->_response->getBody());
-  }
-
-
-  /** @test */
-  public function openingsShouldContainsExceptionnalLabelTeuff() {
-    $this->assertXPathContentContains('//div[contains(@class, "library_schedule")]//li',
-                                      'C\'est la teuff ');
-  }
-
-
-  /** @test */
-  public function openingsShouldContainsExceptionnalLabelRepos() {
-    $this->assertXPathContentContains('//div[contains(@class, "library_schedule")]//li',
-                                      'Repos ');
-  }
-
-
-  /** @test */
-  public function editBibShouldBePresent() {
-    $this->assertXPath('//a[contains(@href,"admin/bib/edit/id/4")]');
-  }
-
-
-  /** @test */
-  public function editOpeningsShouldBePresent() {
-    $this->assertXPath('//a[contains(@href, "admin/ouvertures/index/id_site/4")]');
-  }
-}
 
 
 
@@ -1069,284 +502,6 @@ class BibControllerOpeningHoursAnnecyTest extends BibControllerWithZoneTestCase
 
 
 
-class BibControllerBibViewAnnecyWithOutdatedRangeOpeningsTest extends BibControllerBibViewTestCase {
-  public function setUp() {
-    parent::setUp();
-
-    Class_Ouverture_Visitor::setTimeSource(new TimeSourceForTest('2016-10-25 16:08:42'));
-
-    $admin_bib = $this->fixture('Class_Users',
-                                ['id' => 54,
-                                 'login' => 'admin bib',
-                                 'password' => 'popup',
-                                 'id_site' => 4]);
-    $admin_bib->beAdminBib();
-    ZendAfi_Auth::getInstance()->logUser($admin_bib);
-
-    $this->fixture('Class_Ouverture',
-                   ['id' => 1,
-                    'id_site' => 4,
-                    'jour_semaine' => Class_Ouverture::LUNDI,
-                    'label' => 'D\'habitude']);
-
-    $this->fixture('Class_Ouverture',
-                   ['id' => 2,
-                    'id_site' => 4,
-                    'jour_semaine' => Class_Ouverture::LUNDI,
-                    'validity_start' => '2016-06-30',
-                    'validity_end' => '2016-08-31',
-                    'label' => 'Horaires d\'été']);
-
-
-    $this->dispatch('bib/bibview/id/4', true);
-  }
-
-
-  public function tearDown() {
-    Class_Ouverture_Visitor::setTimeSource(null);
-    parent::tearDown();
-  }
-
-
-  /** @test */
-  public function shouldContainsDefault() {
-    $this->assertXPathContentContains('//div[contains(@class, "library_schedule")]//h3',
-                                      'D\'habitude');
-  }
-
-
-  /** @test */
-  public function shouldNotContainsHorairesDEte() {
-    $this->assertNotXPathContentContains('//div[contains(@class, "library_schedule")]//h3',
-                                         'Horaires d\'été',
-                                         $this->_response->getBody());
-  }
-}
-
-
-
-class BibControllerBibViewAnnecyFreeTextOpeningsTest extends BibControllerBibViewTestCase {
-  public function setUp() {
-    parent::setUp();
-
-    Class_Ouverture_Visitor::setTimeSource(new TimeSourceForTest('2016-07-01 08:08:42'));
-
-    $admin_bib = $this->fixture('Class_Users',
-                                ['id' => 54,
-                                 'login' => 'admin bib',
-                                 'password' => 'popup',
-                                 'id_site' => 4]);
-    $admin_bib->beAdminBib();
-    ZendAfi_Auth::getInstance()->logUser($admin_bib);
-
-    $this->fixture('Class_Ouverture',
-                   ['id' => 1,
-                    'id_site' => 4,
-                    'jour_semaine' => Class_Ouverture::LUNDI,
-                    'label' => 'D\'habitude']);
-
-    $this->bib_annecy
-      ->setHoraire('Fermé pour travaux')
-      ->assertSave();
-
-    $this->dispatch('bib/bibview/id/4', true);
-  }
-
-
-  public function tearDown() {
-    Class_Ouverture_Visitor::setTimeSource(null);
-    parent::tearDown();
-  }
-
-
-  /** @test */
-  public function shouldNotContainsDefaultOpenings() {
-    $this->assertNotXPathContentContains('//div[contains(@class, "library_schedule")]//h3',
-                                         'D\'habitude',
-                                         $this->_response->getBody());
-  }
-
-
-  /** @test */
-  public function editOpeningsShouldNotBePresent() {
-    $this->assertNotXPath('//a[contains(@href, "admin/ouvertures/index/id_site/4")]');
-  }
-}
-
-
-
-class BibControllerBackUrlTest extends BibControllerBibViewTestCase {
-
-  public function setUp() {
-    parent::setUp();
-
-    $_SERVER['HTTP_REFERER'] = '/link/to/referer';
-  }
-
-
-  /** @test */
-  public function backUrlShouldBeZoneView() {
-    $this->dispatch('bib/bibview/id/4', true);
-    $this->assertXPathContentContains('//div[@class="back_link"]/a[contains(@href, "zoneview/id/1")]', 'Retour');
-  }
-
-
-  /** @test */
-  public function backUrlShouldBeReferer() {
-    $this->dispatch('bib/bibview/id/22', true);
-    $this->assertXPathContentContains('//div[@class="back_link"]/a[contains(@href, "/link/to/referer")]', 'Retour');
-  }
-
-}
-
-
-
-class BibControllerTextCustomFieldsTest extends BibControllerBibViewTestCase {
-  public function setUp() {
-    parent::setUp();
-
-
-    $this->custom_field = $this->fixture('Class_CustomField',
-                                          ['id' => 5,
-                                           'priority' => 3,
-                                           'field_type' => Class_CustomField_Meta::TEXT_INPUT,
-                                           'label' => 'Lieu',
-                                           'model' => 'Bib']);
-  }
-
-
-  /** @test */
-  public function customFieldLieuShouldBeDisplayed() {
-    $this->bib_annecy->setCustomField('Lieu', 'Far Far Away');
-    $this->bib_annecy->saveWithCustomFields();
-    $this->dispatch('bib/bibview/id/4', true);
-    $this->assertXPathContentContains("//div//dt", "Lieu", $this->_response->getBody());
-  }
-
-
-  /** @test */
-  public function customFieldValueShouldBeFarFarAway() {
-    $this->bib_annecy->setCustomField('Lieu', 'Far Far Away');
-    $this->bib_annecy->saveWithCustomFields();
-    $this->dispatch('bib/bibview/id/4', true);
-    $this->assertXPathContentContains("//div//dd", "Far Far Away", $this->_response->getBody());
-  }
-
-
-  /** @test */
-  public function customFieldLieuShouldNotBeDisplayed() {
-    $this->bib_annecy->setCustomField('Lieu', '');
-    $this->bib_annecy->saveWithCustomFields();
-    $this->dispatch('bib/bibview/id/4', true);
-    $this->assertNotXPathContentContains("//div//dd", "Lieu", $this->_response->getBody());
-  }
-}
-
-
-
-
-class BibControllerMultiCheckBoxCustomFieldsTest extends BibControllerBibViewTestCase {
-  public function setUp() {
-    parent::setUp();
-
-
-    $this->custom_field = $this->fixture('Class_CustomField',
-                                          ['id' => 2,
-                                           'priority' => 3,
-                                           'field_type' => Class_CustomField_Meta::SELECT,
-                                           'label' => 'Mode',
-                                           'options_list' => 'Expert;Novice',
-                                           'model' => 'Bib']);
-
-
-    $this->custom_field = $this->fixture('Class_CustomField',
-                                          ['id' => 12,
-                                           'priority' => 3,
-                                           'label' => 'Services',
-                                           'options_list' => 'Wifi;Projection;Restauration;l\'Médias',
-                                           'field_type' => Class_CustomField_Meta::MULTI_CHECKBOX,
-                                           'model' => 'Bib']);
-
-
-
-
-    $this->bib_annecy->setCustomField('Services', ['Wifi', 'Restauration','l\'Médias']);
-    $this->bib_annecy->saveWithCustomFields();
-    $this->dispatch('bib/bibview/id/4', true);
-
-  }
-
-
-  /** @test */
-  public function customFieldServicesShouldBeDisplayed() {
-    $this->assertXPathContentContains("//div//h2", "Services");
-  }
-
-
-  /** @test */
-  public function servicesShouldContainsWifi() {
-    $this->assertXPathContentContains('//div[@class="custom1 library_box"]//dd', 'Wifi',$this->_response->getBody());
-  }
-
-
-  /** @test */
-  public function servicesShouldContainsRestauration() {
-    $this->assertXPathContentContains('//div//dd[@class="restauration"]', 'Restauration',$this->_response->getBody());
-  }
-
-
-  /** @test */
-  public function classShouldBeNameWithoutAccents() {
-    $this->assertXPathContentContains('//div//dd[@class="l_medias"]', 'l\'Médias',$this->_response->getBody());
-  }
-
-
-  /** @test */
-  public function servicesShouldNotContainsProjection() {
-    $this->assertNotXPathContentContains('//div//dd', 'Projection');
-  }
-
-
-  /** @test */
-  public function servicesShouldNotContainsSeparator() {
-    $this->assertNotXPathContentContains('//div//dd', 'Wifi;Restauration');
-  }
-}
-
-
-
-class BibControllerBibViewAnnecyWithParamRetourHistoriqueTest extends BibControllerWithZoneTestCase {
-  /** @test */
-  public function withUrlRetourCmsArticleViewFiveShouldBeAccepted() {
-    $this->dispatch('bib/bibview/id/4?retour=cms+articleview+5');
-    $this->assertXPathContentContains('//a[contains(@href, "/cms/articleview/id/5")]',
-                                      'Retour');
-  }
-
-  /** @test */
-  public function withUrlRetourCmsOnlyShouldNotBeAccepted() {
-    $this->dispatch('bib/bibview/id/4?retour=cms');
-    $this->assertXPathContentContains('//a[contains(@href, "/bib/zoneview/id/1")]',
-                                      'Retour');
-  }
-}
-
-
-class BibControllerBibViewInexistantTest extends BibControllerWithZoneTestCase {
-  public function setUp() {
-    parent::setUp();
-
-    $this->dispatch('bib/bibview/');
-  }
-
-  /** @test */
-  public function responseShouldRedirectToIndex() {
-    $this->assertRedirectTo('/opac/bib/index');
-  }
-}
-
-
-
 abstract class BibControllerSelectionTestCase extends AbstractControllerTestCase {
   protected
     $_storm_default_to_volatile = true,