diff --git a/VERSIONS b/VERSIONS index e7fc9f78eb3d62b817e9c5367c54509c008d3f89..f184459dd916e9c824cf2b8ec5e79cbf62547c64 100644 --- a/VERSIONS +++ b/VERSIONS @@ -1,3 +1,19 @@ +10/01/2017 - v7.7.24 + + - ticket #51334 : SIGB CDScript : Ajout du courriel et du numéro de carte dans le lien SSO + + - ticket #53329 : recherche: le bouton "affiner" dans les facettes reprend correctement l'expression de recherche + + +03/01/2017 - v7.7.23, bonne année 2017 :) + + - ticket #52528 : Correction affichage du lien vers la recherche avancée dans la boite de recherche simple + + - ticket #52594 : Administration : les images configurées dans les menus verticaux sont automatiquement cliquables + + - ticket #52364 : Restauration de l'ancienne page listant les formations + + 22/12/2016 - v7.7.22 - ticket #52395 : Résultat recherche mode mur : correction de l'affichage des liens diff --git a/application/modules/opac/controllers/AbonneController.php b/application/modules/opac/controllers/AbonneController.php index b3a1d86280c351a52cebcf0176be2361bb638da2..6f0a93a62e0ec96f5eaf12176881acf52bd24bae 100644 --- a/application/modules/opac/controllers/AbonneController.php +++ b/application/modules/opac/controllers/AbonneController.php @@ -68,7 +68,7 @@ class AbonneController extends ZendAfi_Controller_Action { public function inscrireSessionAction() { - $this->_redirect('/formations'); + $this->_redirectToReferer(); if ((!$session = Class_SessionFormation::find((int)$this->_getParam('id'))) || $session->isInscriptionClosed()) @@ -1183,4 +1183,22 @@ class AbonneController extends ZendAfi_Controller_Action { $this->_redirectToReferer(); } + + + public function formationsAction() { + $this->view->titre = $this->_('S\'inscrire à une formation'); + $this->view->sessions = Class_SessionFormation::findAllAvailable($this->_user); + } + + + public function formationsRegisteredAction() { + $this->view->titre = $this->_('Mes inscriptions en cours'); + $this->view->sessions = Class_SessionFormation::findAllRegistered($this->_user); + } + + + public function formationsDoneAction() { + $this->view->titre = $this->_('Mes formations suivies'); + $this->view->sessions = Class_SessionFormation::findAllDone($this->_user); + } } \ No newline at end of file diff --git a/application/modules/opac/controllers/FormationsController.php b/application/modules/opac/controllers/FormationsController.php index cf677978caf86b0f713a6a4473d91cff526aad3b..76e0edf4b2bd0057fe3d9c8e14b87239edbcc759 100644 --- a/application/modules/opac/controllers/FormationsController.php +++ b/application/modules/opac/controllers/FormationsController.php @@ -28,16 +28,14 @@ class FormationsController extends ZendAfi_Controller_Action { public function indexAction() { - $this->view->titre = $this->_('S\'inscrire à une formation'); - $this->view->sessions = Class_SessionFormation::findAllAvailable($this->_user); + $this->view->formations_by_year = Class_Formation::indexByYear(Class_Formation::findAll()); + $this->view->user = $this->_user; } public function detailSessionAction() { - if (!$session = Class_SessionFormation::find((int)$this->_getParam('id'))) { - $this->_redirect('/formations/index'); - return; - } + if (!$session = Class_SessionFormation::find((int)$this->_getParam('id'))) + return $this->_redirectToReferer(); $this->view->url_retour = ($this->_getParam('retour')) ? $this->_getParam('retour') @@ -46,16 +44,4 @@ class FormationsController extends ZendAfi_Controller_Action { null, true); $this->view->session = $session; } - - - public function registeredAction() { - $this->view->titre = $this->_('Mes inscriptions en cours'); - $this->view->sessions = Class_SessionFormation::findAllRegistered($this->_user); - } - - - public function doneAction() { - $this->view->titre = $this->_('Mes formations suivies'); - $this->view->sessions = Class_SessionFormation::findAllDone($this->_user); - } } \ No newline at end of file diff --git a/application/modules/opac/views/scripts/formations/done.phtml b/application/modules/opac/views/scripts/abonne/formations-done.phtml similarity index 87% rename from application/modules/opac/views/scripts/formations/done.phtml rename to application/modules/opac/views/scripts/abonne/formations-done.phtml index f392073053ad899b1502b02c8bee3147f8cac1f3..3ae1411b8405b747f14fa5d66a5bb4c41181a04a 100644 --- a/application/modules/opac/views/scripts/formations/done.phtml +++ b/application/modules/opac/views/scripts/abonne/formations-done.phtml @@ -1,7 +1,8 @@ <?php $this->openBoite($this->titre); -$details_link = $this->url(['action' => 'detail-session', +$details_link = $this->url(['controller' => 'formations', + 'action' => 'detail-session', 'id' => null]); $current_link = $this->url(); diff --git a/application/modules/opac/views/scripts/formations/registered.phtml b/application/modules/opac/views/scripts/abonne/formations-registered.phtml similarity index 95% rename from application/modules/opac/views/scripts/formations/registered.phtml rename to application/modules/opac/views/scripts/abonne/formations-registered.phtml index 083c956a790997158020e0cbaf60205e92f53b3f..7e0c7f561b924a35e1125df3efb8c1522308dbe9 100644 --- a/application/modules/opac/views/scripts/formations/registered.phtml +++ b/application/modules/opac/views/scripts/abonne/formations-registered.phtml @@ -1,7 +1,8 @@ <?php $this->openBoite($this->titre); -$details_link = $this->url(['action' => 'detail-session', +$details_link = $this->url(['controller' => 'formations', + 'action' => 'detail-session', 'id' => null]); $unregister_link = $this->url(['controller' => 'abonne', diff --git a/application/modules/opac/views/scripts/abonne/formations.phtml b/application/modules/opac/views/scripts/abonne/formations.phtml new file mode 100644 index 0000000000000000000000000000000000000000..a941c069b62923d628a285c068d3f60d8e584b03 --- /dev/null +++ b/application/modules/opac/views/scripts/abonne/formations.phtml @@ -0,0 +1,45 @@ +<?php +echo $this->openBoite($this->titre); + +$details_link = $this->url(['controller' => 'formations', + 'action' => 'detail-session', + 'id' => null]); + +$register_link = $this->url(['controller' => 'abonne', + 'action' => 'inscrire-session', + 'id' => null]); + +$current_link = $this->url(); + +echo $this->tagModelTable( + $this->sessions, + [$this->_('Formation'), + $this->_('Date'), + $this->_('Lieu'), + $this->_('Informations')], + ['libelle_formation', + 'date_debut_texte', + 'libelle_lieu', + 'infos'], + [function($model) use($details_link, $register_link, $current_link) { + return $this->renderModelActions($model, + [['url' => $details_link . '/id/%s?retour=' . $current_link, + 'icon' => 'view', + 'label' => $this->_('Details de la session %s', + $model->getLabel())], + ['url' => $register_link . '/id/%s', + 'icon' => 'add_user', + 'label' => $this->_('S\'inscrire à la session %s', + $model->getLabel())]] + );}], + 'available_sessions', + null, + ['infos' => function($model) { + return $this->_('Date limite d\'inscription : %s', + $model->getDateLimiteInscriptionHumanRead()); + }] +); + +$this->closeBoite(); + +echo $this->abonne_RetourFiche(); diff --git a/application/modules/opac/views/scripts/formations/index.phtml b/application/modules/opac/views/scripts/formations/index.phtml index 016fcf6f2f132a0ed643a554b6f0bb83b2c0260b..68cfc73c8f6e3932074a874b996e2f173cf6ffd8 100644 --- a/application/modules/opac/views/scripts/formations/index.phtml +++ b/application/modules/opac/views/scripts/formations/index.phtml @@ -1,44 +1,19 @@ <?php -echo $this->openBoite($this->titre); +echo $this->openBoite('Formations'); -$details_link = $this->url(['action' => 'detail-session', - 'id' => null]); +if ($this->user && !$this->user->hasRightSuivreFormation()) + echo sprintf('<p class="error">%s</p>', + $this->_("Vous n'avez pas les droits suffisants pour vous inscrire à une formation")); -$register_link = $this->url(['controller' => 'abonne', - 'action' => 'inscrire-session', - 'id' => null]); +foreach($this->formations_by_year as $year => $formations) { + echo '<div class="formations">'; + echo $this->partialCycle('formations/_formation.phtml', + 'formation', + $formations, + ['first', 'second']); + echo '</div>'; +} -$current_link = $this->url(); - -echo $this->tagModelTable( - $this->sessions, - [$this->_('Formation'), - $this->_('Date'), - $this->_('Lieu'), - $this->_('Informations')], - ['libelle_formation', - 'date_debut_texte', - 'libelle_lieu', - 'infos'], - [function($model) use($details_link, $register_link, $current_link) { - return $this->renderModelActions($model, - [['url' => $details_link . '/id/%s?retour=' . $current_link, - 'icon' => 'view', - 'label' => $this->_('Details de la session %s', - $model->getLabel())], - ['url' => $register_link . '/id/%s', - 'icon' => 'add_user', - 'label' => $this->_('S\'inscrire à la session %s', - $model->getLabel())]] - );}], - 'available_sessions', - null, - ['infos' => function($model) { - return $this->_('Date limite d\'inscription : %s', - $model->getDateLimiteInscriptionHumanRead()); - }] -); - -$this->closeBoite(); - -echo $this->abonne_RetourFiche(); +echo $this->closeBoite(); +if ($this->user) echo $this->abonne_RetourFiche(); +?> diff --git a/library/Class/SessionFormation.php b/library/Class/SessionFormation.php index 894b15e30d1b99411e67c40cc260ed68ec480831..322cfae1349d68fb31a0344aa804012c1310583f 100644 --- a/library/Class/SessionFormation.php +++ b/library/Class/SessionFormation.php @@ -20,7 +20,6 @@ */ class SessionFormationLoader extends Storm_Model_Loader { - public function findAllAvailable($user) { if(!$user) return []; diff --git a/library/Class/WebService/SIGB/CdScript/Service.php b/library/Class/WebService/SIGB/CdScript/Service.php index a67bc9c63468fdb9f0aff81559702c075b557d48..a55cf129827c8163c4f5aebc80aeb60eaa58e44c 100644 --- a/library/Class/WebService/SIGB/CdScript/Service.php +++ b/library/Class/WebService/SIGB/CdScript/Service.php @@ -74,11 +74,11 @@ class Class_Webservice_SIGB_CdScript_Service extends Class_WebService_SIGB_Abstr protected function getUserInfo($user) { - return '&user='. implode(':', [$user->getIdSigb(), + return '&user='. implode(':', [$user->getIdabon(), $user->getNom(), $user->getPrenom(), $user->getNaissance(), - '', + $user->getMail(), $user->getDateFin()]); } diff --git a/library/ZendAfi/View/Helper/Abonne/Formations.php b/library/ZendAfi/View/Helper/Abonne/Formations.php index 60766ac6627fae89ea4213dd421d2ea25b447f61..ab32b9c9e324680b0b7998fa156e78f8261078b8 100644 --- a/library/ZendAfi/View/Helper/Abonne/Formations.php +++ b/library/ZendAfi/View/Helper/Abonne/Formations.php @@ -25,8 +25,8 @@ class ZendAfi_View_Helper_Abonne_Formations extends ZendAfi_View_Helper_Abonne_A || !$user->hasRightSuivreFormation()) return ''; - $action_url = $this->view->url(['controller' => 'formations', - 'action' => 'index'], + $action_url = $this->view->url(['controller' => 'abonne', + 'action' => 'formations'], null, true); @@ -43,12 +43,12 @@ class ZendAfi_View_Helper_Abonne_Formations extends ZendAfi_View_Helper_Abonne_A return $this ->_tag('ul', $this->_tag('li', - $this->view->tagAnchor(['controller' => 'formations', - 'action' => 'done'], + $this->view->tagAnchor(['controller' => 'abonne', + 'action' => 'formations-done'], $this->_('Mes formations suivies'))) . $this->_tag('li', - $this->view->tagAnchor(['controller' => 'formations', - 'action' => 'registered'], + $this->view->tagAnchor(['controller' => 'abonne', + 'action' => 'formations-registered'], $this->_('Mes inscriptions en cours')))); } } \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/Accueil/MenuVertical.php b/library/ZendAfi/View/Helper/Accueil/MenuVertical.php index a560eb2fe95ef1cab45bf6baa6d1c5552da8e393..942106905fb347e01f7dabc26fff7b7e7462a9ae 100644 --- a/library/ZendAfi/View/Helper/Accueil/MenuVertical.php +++ b/library/ZendAfi/View/Helper/Accueil/MenuVertical.php @@ -193,21 +193,26 @@ class ZendAfi_View_Helper_Accueil_MenuVertical extends ZendAfi_View_Helper_Accue $target = ($param_url["target"] > "") ? $param_url["target"] : null; $a_href = $url ? "href='".htmlspecialchars($url)."'" : ""; - $a_target = $target ? "target='$target'" : ""; + $a_target = $target ? ['target' => $target] : []; $class = $this->_getContextClass(isset($menuitem["preferences"]["clef_profil"]) ? (int) $menuitem["preferences"]['clef_profil'] : '0'); $content ='<li class="'.$class.'">'; - $content .= $this->getMenuPicto($menuitem); - - $content .= - '<a '.$a_href.' '.$a_target.' >'. - htmlspecialchars($menuitem["libelle"]). - '</a>'; - + $content .= $this->_getMenuEntry(htmlspecialchars($url), $a_target, $menuitem); $content .= '</li>'; return $content; } + protected function _getMenuEntry($url, $target, $item, $sub_menu = false) { + $sub_menu = $sub_menu + ? $this->afficherSousMenu($url) + : []; + + return $this->view->tagAnchor($url, + $this->getMenuPicto($item) . htmlspecialchars($item['libelle']), + array_merge($target, $sub_menu)); + } + + /** * @param array $menuitem * @return string @@ -295,11 +300,10 @@ class ZendAfi_View_Helper_Accueil_MenuVertical extends ZendAfi_View_Helper_Accue private function _renderListItem($menuitem, $url = '#', $target = null) { $a_target = $target ? ['target' => $target] : []; - $content = $this->view->tagAnchor($url, - $this->getMenuPicto($menuitem) - . htmlspecialchars($menuitem['libelle']), - array_merge($a_target, - $this->afficherSousMenu($url))); + $content = $this->_getMenuEntry($url, + $a_target, + $menuitem, + true); if($this->preferences['new_html']=='1') { $content.= $this->_getSubItemsHtml($menuitem['sous_menus']); diff --git a/library/ZendAfi/View/Helper/Facettes.php b/library/ZendAfi/View/Helper/Facettes.php index aeaff3261bff0bb69dd0d7386dc21588ee13dcc5..7d2ab5ef99ef41806e697689c835a79a1044504b 100644 --- a/library/ZendAfi/View/Helper/Facettes.php +++ b/library/ZendAfi/View/Helper/Facettes.php @@ -81,7 +81,9 @@ class ZendAfi_View_Helper_Facettes extends ZendAfi_View_Helper_BaseHelper { $button = $this->view->tag('button', $this->_('Affiner'), $attribs); - return $this->_tag('form', $button . $this->_tag('ul', $html) . $button, ['method' => 'POST']); + return $this->_tag('form', + $button . $this->_tag('ul', $html) . $button, + ['method' => 'POST', 'action' => $this->view->url($url)]); } diff --git a/library/ZendAfi/View/Helper/TagRechercheSimple.php b/library/ZendAfi/View/Helper/TagRechercheSimple.php index 64915c5f866b4cd66f2bae047f3753fab8e4ba75..d8c095a53a0606558e2591eb9308503a7bfee78a 100644 --- a/library/ZendAfi/View/Helper/TagRechercheSimple.php +++ b/library/ZendAfi/View/Helper/TagRechercheSimple.php @@ -42,7 +42,7 @@ class ZendAfi_View_Helper_TagRechercheSimple extends Zend_View_Helper_HtmlElemen public function renderRechercheAvancee() { - if (!in_array($this->preferences["recherche_avancee"], ['on', 1], true)) + if (!in_array($this->preferences["recherche_avancee"], ['on', 1, '1'], true)) return ''; return '<div class="recherche_avancee">'. diff --git a/library/startup.php b/library/startup.php index bbf599c51be81b9237c89c894cc266df04e14ce5..5d1d102eb49b5f7d7f6f92ce4976e23a21ad8509 100644 --- a/library/startup.php +++ b/library/startup.php @@ -83,7 +83,7 @@ class Bokeh_Engine { function setupConstants() { defineConstant('BOKEH_MAJOR_VERSION','7.7'); - defineConstant('BOKEH_RELEASE_NUMBER', BOKEH_MAJOR_VERSION . '.22'); + defineConstant('BOKEH_RELEASE_NUMBER', BOKEH_MAJOR_VERSION . '.24'); defineConstant('BOKEH_REMOTE_FILES', 'http://git.afi-sa.fr/afi/opacce/'); diff --git a/scripts/emacs/phafi-mode.el b/scripts/emacs/phafi-mode.el index 5649758caa001e8b7807d27f5dd747f24138e244..bbda7c8080e4d22c31b781824592e77d7a34783a 100644 --- a/scripts/emacs/phafi-mode.el +++ b/scripts/emacs/phafi-mode.el @@ -624,6 +624,15 @@ ) +(defun phafi-autofocus-version () + (interactive) + (async-shell-command (concat + "cd " (phafi-root-dir) ";" + "autofocus version" + )) + ) + + (defun phafi-select-db () (interactive) (require 'mysql-query) diff --git a/tests/application/modules/opac/controllers/AbonneControllerFormationsTest.php b/tests/application/modules/opac/controllers/AbonneControllerFormationsTest.php index 80d376e551e370e9975a40dbb528ffe02cd4b3b1..4aa71504d96c18d5d3f5076aa31b396ef75451e1 100644 --- a/tests/application/modules/opac/controllers/AbonneControllerFormationsTest.php +++ b/tests/application/modules/opac/controllers/AbonneControllerFormationsTest.php @@ -42,6 +42,8 @@ abstract class AbstractAbonneControllerFormationsTestCase public function setUp() { parent::setUp(); + $_SERVER['HTTP_REFERER'] = '/formations'; + $test_time = new TimeSourceForTest('2014-05-01 14:00:00'); Class_Formation::setTimeSource($test_time); @@ -211,31 +213,28 @@ class AbonneControllerFormationsListWithLearnJavaNotVisibleTest extends Abstract public function setUp() { parent::setUp(); $this->_learn_java->hide()->save(); - $this->dispatch('/opac/formations', true); + $this->dispatch('/opac/abonne/formations', true); } /** @test */ - function noH2ShouldContainsLearnJava() { + public function noH2ShouldContainsLearnJava() { $this->assertNotXPathContentContains('//h2', 'Learn Java'); } /** @test */ - function sessionMarsShouldNotBeVisible() { + public function sessionMarsShouldNotBeVisible() { $this->assertNotXPathContentContains('//tbody//tr//td', '1 mars 2014'); } - } class AbonneControllerFormationsSessionListWithLearnSmalltalkNotVisibleTest extends AbstractAbonneControllerFormationsTestCase { - - /** @test */ public function trainingJavaShouldBeDisplayed() { - $this->dispatch('/opac/formations', true); + $this->dispatch('/opac/abonne/formations', true); $this->assertXPathContentContains('//td', 'Learn Java'); } @@ -243,7 +242,7 @@ class AbonneControllerFormationsSessionListWithLearnSmalltalkNotVisibleTest exte /** @test */ function noH2ShouldContainsLearnSmalltalk() { $this->_learn_smalltalk->hide()->save(); - $this->dispatch('/opac/formations', true); + $this->dispatch('/opac/abonne/formations', true); $this->assertNotXPathContentContains('//h2', 'Learn Smalltalk'); } @@ -251,7 +250,7 @@ class AbonneControllerFormationsSessionListWithLearnSmalltalkNotVisibleTest exte /** @test */ function sessionJuilletShouldNotBeVisibleIfParentTrainingIsHidden() { $this->_learn_smalltalk->hide()->save(); - $this->dispatch('/opac/formations', true); + $this->dispatch('/opac/abonne/formations', true); $this->assertNotXPathContentContains('//tbody//tr//td', '11 juillet 2014'); } @@ -260,7 +259,7 @@ class AbonneControllerFormationsSessionListWithLearnSmalltalkNotVisibleTest exte function sessionJuilletShouldNotBeVisibleIfHidden() { $this->_learn_smalltalk->show()->save(); $this->_session_smalltalk_juillet->hide()->save(); - $this->dispatch('/opac/formations', true); + $this->dispatch('/opac/abonne/formations', true); $this->assertNotXPathContentContains('//tbody//tr//td', '11 juillet 2014'); } @@ -269,10 +268,9 @@ class AbonneControllerFormationsSessionListWithLearnSmalltalkNotVisibleTest exte function sessionJuilletShouldBeVisibleIfShow() { $this->_learn_smalltalk->show()->save(); $this->_session_smalltalk_juillet->show()->save(); - $this->dispatch('/opac/formations', true); + $this->dispatch('/opac/abonne/formations', true); $this->assertXPathContentContains('//td', '11 juillet 2014'); } - } @@ -293,7 +291,7 @@ class AbonneControllerFormationsListTest extends AbstractAbonneControllerFormati ->show() ->assertSave(); - $this->dispatch('/opac/formations', true); + $this->dispatch('/opac/abonne/formations', true); } @@ -431,13 +429,13 @@ class AbonneControllerFormationsListTest extends AbstractAbonneControllerFormati class AbonneControllerFormationsFicheAbonneTest extends AbstractAbonneControllerFormationsTestCase { public function setUp() { parent::setUp(); - $this->dispatch('/opac/abonne/fiche?retour=/opac/abonne/fiche', true); + $this->dispatch('/opac/abonne/fiche', true); } /** @test */ public function pageShouldContainsLinkToFormations() { - $this->assertXPathContentContains('//a[contains(@href, "/formations")]', + $this->assertXPathContentContains('//a[contains(@href, "/abonne/formations")]', 'S\'inscrire à une formation'); } @@ -450,14 +448,14 @@ class AbonneControllerFormationsFicheAbonneTest extends AbstractAbonneController /** @test */ public function pageShouldContainsLinkToRegistrations() { - $this->assertXPathContentContains('//a[contains(@href, "/formations/registered")]', + $this->assertXPathContentContains('//a[contains(@href, "/abonne/formations-registered")]', 'Mes inscriptions en cours'); } /** @test */ public function pageShouldContainsLinkToDone() { - $this->assertXPathContentContains('//a[contains(@href, "/formations/done")]', + $this->assertXPathContentContains('//a[contains(@href, "/abonne/formations-done")]', 'Mes formations suivies'); } } @@ -470,7 +468,7 @@ class AbonneControllerFormationsRegisteredActionTest public function setUp() { parent::setUp(); - $this->dispatch('/formations/registered', true); + $this->dispatch('/abonne/formations-registered', true); } @@ -523,10 +521,9 @@ class AbonneControllerFormationsDoneActionTest extends AbstractAbonneControllerFormationsTestCase { public function setUp() { - parent::setUp(); $this->_session_python_juillet->setDateDebut('2006-09-09')->assertSave(); - $this->dispatch('/formations/done', true); + $this->dispatch('/abonne/formations-done', true); } @@ -588,7 +585,7 @@ class AbonneControllerFormationsListWithoutRightSuivreFormationTest extends Abst public function setUp() { parent::setUp(); $this->_amadou->setUserGroups([]); - $this->dispatch('/opac/formations'); + $this->dispatch('/opac/abonne/formations'); } @@ -816,7 +813,7 @@ class AbonneControllerFormationsSessionJavaFevrierFullListTest extends AbonneCon parent::setUp(); Class_AdminVar::newInstanceWithId('CHAMPS_FICHE_UTILISATEUR', ['valeur' => 'pseudo;nom;prenom;mail']); - $this->dispatch('/opac/formations'); + $this->dispatch('/opac/abonne/formations'); } @@ -833,7 +830,7 @@ class AbonneControllerFormationsSessionJavaFevrierFullAndInscritListTest extends public function pageShouldHaveLinkToDesinscrire() { $this->_session_java_fevrier->addStagiaire($this->_amadou); $this->_amadou->setSessionFormations(array($this->_session_java_fevrier)); - $this->dispatch('/opac/formations/registered'); + $this->dispatch('/opac/abonne/formations-registered'); $this->assertXPath('//a[contains(@href, "abonne/desinscrire-session/id/31")]'); } } @@ -886,14 +883,10 @@ class AbonneControllerFormationsInscritSessionWithoutRightSuivreFormationTest ex class AbonneControllerFormationsAmadouDesinscritSessionJuilletPythonTest extends AbstractAbonneControllerFormationsTestCase { - protected $_mails, $_previous_referer; + protected $_mails; public function setUp() { parent::setUp(); - $this->_previous_referer = isset($_SERVER['HTTP_REFERER']) - ? $_SERVER['HTTP_REFERER'] - : null; - $_SERVER['HTTP_REFERER'] = '/formations'; $this->dispatch('/opac/abonne/desinscrire-session/id/121', true); @@ -901,14 +894,6 @@ class AbonneControllerFormationsAmadouDesinscritSessionJuilletPythonTest } - public function tearDown() { - if ($this->_previous_referer) - $_SERVER['HTTP_REFERER'] = $this->_previous_referer; - - parent::tearDown(); - } - - /** @test */ function answerShouldRedirectToFormationList() { $this->assertRedirectTo('/formations'); @@ -1098,43 +1083,29 @@ class AbonneControllerFormationsSessionJuilletPythonDetailRetourFicheTest extend class AbonneControllerFormationsWrongIdsTest extends AbstractAbonneControllerFormationsTestCase { - protected $_previous_referer; - public function setUp() { parent::setUp(); - - $this->_previous_referer = isset($_SERVER['HTTP_REFERER']) - ? $_SERVER['HTTP_REFERER'] - : null; - - $_SERVER['HTTP_REFERER'] = '/formations'; + $_SERVER['HTTP_REFERER'] = '/abonne/formations'; } - public function tearDown() { - if ($this->_previous_referer) - $_SERVER['HTTP_REFERER'] = $this->_previous_referer; - - parent::tearDown(); - } - /** @test */ public function detailSessionShouldRedirectToFormations() { $this->dispatch('/opac/formations/detail-session/id/9999'); - $this->assertRedirectTo('/formations/index'); + $this->assertRedirectTo('/abonne/formations'); } /** @test */ public function inscrireSessionShouldRedirectToFormations() { $this->dispatch('/opac/abonne/inscrire-session/id/9999'); - $this->assertRedirectTo('/formations'); + $this->assertRedirectTo('/abonne/formations'); } /** @test */ public function desinscrireSessionShouldRedirectToFormations() { $this->dispatch('/opac/abonne/desinscrire-session/id/9999'); - $this->assertRedirectTo('/formations'); + $this->assertRedirectTo('/abonne/formations'); } } \ No newline at end of file diff --git a/tests/application/modules/opac/controllers/FormationsControllerTest.php b/tests/application/modules/opac/controllers/FormationsControllerTest.php index 7bfdd5e7c8997b130fea130c200f727e1baf1864..00019e0792517781d8aad811480d10edb2467d94 100644 --- a/tests/application/modules/opac/controllers/FormationsControllerTest.php +++ b/tests/application/modules/opac/controllers/FormationsControllerTest.php @@ -127,6 +127,24 @@ class FormationsControllerFormationsSessionFevrierJavaTest extends AbstractForma + +class FormationsControllerAnonymousTest extends AbstractFormationsControllerTestCase { + public function setUp() { + parent::setUp(); + $this->dispatch('/opac/formations', true); + } + + + /** @test */ + public function sessionShouldDisplaySubscribeTime() { + $this->assertXPathContentContains('//tbody//tr/td/span', + 'Date de limite d\'inscription:'); + } +} + + + + class FormationsControllerFormationsSessionJuilletPythonDetailRetourFicheTest extends AbstractFormationsControllerTestCase { public function setUp() { parent::setUp(); @@ -137,5 +155,4 @@ class FormationsControllerFormationsSessionJuilletPythonDetailRetourFicheTest ex public function pageShouldContainsAButtontoGoBackToFicheAbonne() { $this->assertXPathContentContains('//a[contains(@href, "abonne/fiche")]', 'Retour', $this->_response->getBody()); } - } \ No newline at end of file diff --git a/tests/application/modules/opac/controllers/NoticeAjaxControllerCdScriptTest.php b/tests/application/modules/opac/controllers/NoticeAjaxControllerCdScriptTest.php index 65e0b95fcaec3c873d881f43de3cc11c1087e61c..9ca4d608a3084d2e18a1a0404ed06801ee381e5e 100644 --- a/tests/application/modules/opac/controllers/NoticeAjaxControllerCdScriptTest.php +++ b/tests/application/modules/opac/controllers/NoticeAjaxControllerCdScriptTest.php @@ -38,6 +38,7 @@ class NoticeAjaxControllerCdScriptRecordTest extends AbstractControllerTestCase 'nom' => 'Le Pollux', 'prenom' => 'Paul', 'id_sigb' => '654987', + 'idabon' => '23901000323008', 'mail' => 'anemail@web.com', 'naissance' => '2002-12-14', 'password' => 'pollux', @@ -84,7 +85,9 @@ class NoticeAjaxControllerCdScriptRecordTest extends AbstractControllerTestCase /** @test */ public function linkToJumelShouldBePresent() { - $this->assertXPathContentContains('//table//a[contains(@href, "www.jumel39.fr/docnum.php?bib=2&res=kio&lien=456789&time=1446019200&user=654987:Le Pollux:Paul:2002-12-14::2015-12-14")]', 'Description en ligne', $this->_response->getBody()); + $this->assertXPathContentContains('//table//a[contains(@href, "www.jumel39.fr/docnum.php?bib=2&res=kio&lien=456789&time=1446019200&user=23901000323008:Le Pollux:Paul:2002-12-14:anemail@web.com:2015-12-14")]', + 'Description en ligne', + $this->_response->getBody()); } diff --git a/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php b/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php index 578a06d8abea93b2cc0f23ead17c53c755f7cd24..6c06039c4e646b8438a7d9c16eded2506793546a 100644 --- a/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php +++ b/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php @@ -2638,6 +2638,12 @@ class ProfilOptionsControllerToggleMenuAndResponsiveOptionsTest extends ProfilOp public function toggleMenuCallFunctionShouldBePresent() { $this->assertXPathContentContains('//script', '$("#header #boite_1").toggle_menu_slider();'); } + + + /** @test */ + public function bookmarkImageShouldBeInAnchor() { + $this->assertXPath('//ul/li/a/img[contains(@src, "bookmark.png")]'); + } } @@ -2664,7 +2670,7 @@ class ProfilOptionsControllerSelectedActionInMenuVerticalWidgetTest extends Prof /** @test */ public function liBokehFaqShouldNotHaveClassSelectedAction() { - $this->assertXPathContentContains('//ul/li//ul/li[@class="menuGauche"]', 'Bokeh FAQ'); + $this->assertXPathContentContains('//ul/li//ul/li[@class="menuGauche"]/a', 'Bokeh FAQ'); } } diff --git a/tests/application/modules/opac/controllers/RechercheControllerTest.php b/tests/application/modules/opac/controllers/RechercheControllerTest.php index d42a1f45c57a4631fbd0ce6af86892514a81f26a..8d0327cc4e3dddc2af9ee23fb624e40d67802931 100644 --- a/tests/application/modules/opac/controllers/RechercheControllerTest.php +++ b/tests/application/modules/opac/controllers/RechercheControllerTest.php @@ -3330,9 +3330,6 @@ class RechercheControlleSiteInResultAndModeThumbnailTest extends RechercheContro class RechercheControllerMultiFacettesTest extends RechercheControllerNoticeTestCase { protected $_default_storm_to_volatile = true; - public function setUp() { - parent::setUp(); - } /** @test */ public function postShouldRedirectToMultifacetsT1T4() { @@ -3343,6 +3340,23 @@ class RechercheControllerMultiFacettesTest extends RechercheControllerNoticeTest } + /** @test */ + public function multifacetsFormShouldContainsExpressionRechercheParamOnSearchResult() { + Class_Profil::getCurrentProfil() + ->setCfgModules(['recherche' => ['resultatsimple' => ['facettes_codes'=>'MFSABZLYHTHEMHTES1V', + 'facettes_actif' => 1]]]) + ->assertSave(); + + $this->mock_sql + ->whenCalled('fetchAll') + ->answers([ [$this->notice->getId(), $this->notice->getFacettes()] ]); + + $this->postDispatch('/recherche/simple', + ['expressionRecherche' => 'pomme']); + $this->assertXPath('//div[@class="facette"]/form[@method="POST"][@action="/recherche/simple/expressionRecherche/pomme"]'); + } + + /** @test */ public function activeFacetsShouldBeT1OrT4() { $this->dispatch('/recherche/simple/expressionRecherche/pomme/tri/*/multifacets/T1-T4'); diff --git a/tests/library/Class/WebService/SIGB/CdScriptTest.php b/tests/library/Class/WebService/SIGB/CdScriptTest.php index 23fd616754423d3de4528a6d34d6aaad44fea265..3b52b876b949da34dab195815247d1ec7bc1756e 100644 --- a/tests/library/Class/WebService/SIGB/CdScriptTest.php +++ b/tests/library/Class/WebService/SIGB/CdScriptTest.php @@ -57,6 +57,7 @@ class CdScriptServiceTest extends CdScriptTestCase { 'nom' => 'Le Pollux', 'prenom' => 'Paul', 'id_sigb' => '654987', + 'idabon' => '23901000323008', 'mail' => 'anemail@web.com', 'naissance' => '2002-12-14', 'password' => 'pollux', @@ -72,7 +73,8 @@ class CdScriptServiceTest extends CdScriptTestCase { 'id_bib' => 3, 'zone995' => 'a:3:{i:0;a:2:{s:4:"code";s:1:"a";s:6:"valeur";s:10:"Le Kiosque";}i:1;a:2:{s:4:"code";s:1:"b";s:6:"valeur";s:3:"kio";}i:2;a:2:{s:4:"code";s:1:"f";s:6:"valeur";s:3:"319";}}']); - $this->_sigb_le_kiosque = $this->_service->getNotice('456789')->getExemplaireByCodeBarre('456789'); + $this->_sigb_le_kiosque = $this->_service->getNotice('456789') + ->getExemplaireByCodeBarre('456789'); } @@ -90,7 +92,8 @@ class CdScriptServiceTest extends CdScriptTestCase { /** @test */ public function ressourceUrlShouldBeJumelBib2UserPaulAnd12oclok() { - $this->assertEquals('www.jumel39.fr/docnum.php?bib=2&res=kio&lien=456789&time=1446019200&user=654987:Le Pollux:Paul:2002-12-14::2015-12-14', $this->_service->getRessourceUrl($this->_le_kiosque)); + $this->assertEquals('www.jumel39.fr/docnum.php?bib=2&res=kio&lien=456789&time=1446019200&user=23901000323008:Le Pollux:Paul:2002-12-14:anemail@web.com:2015-12-14', + $this->_service->getRessourceUrl($this->_le_kiosque)); } @@ -102,7 +105,8 @@ class CdScriptServiceTest extends CdScriptTestCase { /** @test */ public function leKiosqueItemUrlShouldBeJumelLink() { - $this->assertEquals('www.jumel39.fr/docnum.php?bib=2&res=kio&lien=456789&time=1446019200&user=654987:Le Pollux:Paul:2002-12-14::2015-12-14', $this->_le_kiosque->getUrl()); + $this->assertEquals('www.jumel39.fr/docnum.php?bib=2&res=kio&lien=456789&time=1446019200&user=23901000323008:Le Pollux:Paul:2002-12-14:anemail@web.com:2015-12-14', + $this->_le_kiosque->getUrl()); } diff --git a/tests/library/ZendAfi/View/Helper/TagRechercheSimpleTest.php b/tests/library/ZendAfi/View/Helper/TagRechercheSimpleTest.php index fdd6a40b1a17286a69f41d12486057de60a71614..84cfe63a079c2a1143517a5b817b8127ffe118ad 100644 --- a/tests/library/ZendAfi/View/Helper/TagRechercheSimpleTest.php +++ b/tests/library/ZendAfi/View/Helper/TagRechercheSimpleTest.php @@ -19,42 +19,42 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -require_once('ViewHelperTestCase.php'); - -class ZendAfi_View_Helper_TagRechercheSimpleDefaultTest extends ViewHelperTestCase { - /** @var ZendAfi_View_Helper_TagRechercheSimple */ - protected $_helper; - - /** @var Class_Album */ - protected $_album; - - /** @var array */ - protected $_preferences = null; +abstract class ZendAfi_View_Helper_TagRechercheSimpleTestCase extends ViewHelperTestCase { + protected + $_storm_default_to_volatile = true, + $_helper, + $_preferences; public function setUp() { parent::setUp(); + + $this->onLoaderOfModel('Class_Catalogue') + ->whenCalled('saveThesaurus') + ->answers(null); + $view = new ZendAfi_Controller_Action_Helper_View(); $this->_helper = new ZendAfi_View_Helper_TagRechercheSimple(); $this->_helper->setView($view); $this->_preferences = (new Class_Systeme_ModulesAccueil_RechercheSimple())->getDefaultValues(); - $this->_preferences['placeholder'] = 'ex: Nineteen Eighty Four'; } +} - /** @test */ - public function withoutTypeDocAndProfilRedirectActionShouldBeRechercheSimpleWithoutMoreParams() { - $html = $this->_helper->tagRechercheSimple($this->_preferences, 1); - $this->assertNotXPath($html, '//form[contains(@action, "/simple/")]', $html); + +class ZendAfi_View_Helper_TagRechercheSimpleDefaultTest + extends ZendAfi_View_Helper_TagRechercheSimpleTestCase { + + public function setUp() { + parent::setUp(); + $this->_preferences['placeholder'] = 'ex: Nineteen Eighty Four'; } /** @test */ - public function rechercheAvanceeShouldBeVisible() { + public function withoutTypeDocAndProfilRedirectActionShouldBeRechercheSimpleWithoutMoreParams() { $html = $this->_helper->tagRechercheSimple($this->_preferences, 1); - $this->assertXPathContentContains($html, - '//a[contains(@href, "/recherche/avancee/statut/reset")]', - utf8_encode('Recherche avancée')); + $this->assertNotXPath($html, '//form[contains(@action, "/simple/")]', $html); } @@ -83,32 +83,26 @@ class ZendAfi_View_Helper_TagRechercheSimpleDefaultTest extends ViewHelperTestCa /** @test */ public function withDomainSelectInputShouldBePresent() { - $this->fixture('Class_Catalogue', - ['id' => 4, - 'libelle' => 'Youths']); - - $this->fixture('Class_Catalogue', - ['id' => 5, - 'libelle' => 'Adults']); + $this->fixture('Class_Catalogue', ['id' => 4, 'libelle' => 'Youths']); + $this->fixture('Class_Catalogue', ['id' => 5, 'libelle' => 'Adults']); $this->fixture('Class_CodifThesaurus', ['id' => 4, - 'id_thesaurus' => 'CCCC0004', + 'id_thesaurus' => 'CCCC0001', 'id_origine' => 4, 'code' => 'Catalogue', 'libelle' => 'Youths']); $this->fixture('Class_CodifThesaurus', ['id' => 5, - 'id_thesaurus' => 'CCCC0005', + 'id_thesaurus' => 'CCCC0002', 'id_origine' => 5, 'code' => 'Catalogue', 'libelle' => 'Adults']); $this->_preferences['domain_ids'] = 'a-4-5-b 1-'; $html = $this->_helper->tagRechercheSimple($this->_preferences, 1); - $this->assertXPathCount($html, '//select[@name="facettes"]//option', - 3); + $this->assertXPathCount($html, '//select[@name="facettes"]//option', 3); return $html; } @@ -130,7 +124,7 @@ class ZendAfi_View_Helper_TagRechercheSimpleDefaultTest extends ViewHelperTestCa */ public function domainSelectSecondOptionShouldBeAdults($html) { $this->assertXPathContentContains($html, - '//select[@name="facettes"]/option[2][@value="HCCCC0005"]', + '//select[@name="facettes"]/option[2][@value="HCCCC0002"][@label="Adults"]', 'Adults'); } @@ -141,7 +135,7 @@ class ZendAfi_View_Helper_TagRechercheSimpleDefaultTest extends ViewHelperTestCa */ public function domainSelectThirdOptionShouldBeYouths($html) { $this->assertXPathContentContains($html, - '//select[@name="facettes"]/option[3][@value="HCCCC0004"]', + '//select[@name="facettes"]/option[3][@value="HCCCC0001"][@label="Youths"]', 'Youths'); } } @@ -149,19 +143,15 @@ class ZendAfi_View_Helper_TagRechercheSimpleDefaultTest extends ViewHelperTestCa -class ZendAfi_View_Helper_TagRechercheSimpleWithSessionParamsTest extends ViewHelperTestCase { +class ZendAfi_View_Helper_TagRechercheSimpleWithSessionParamsTest + extends ZendAfi_View_Helper_TagRechercheSimpleTestCase { + protected $_session; public function setUp() { parent::setUp(); $this->_session = Zend_Registry::get('session'); - $view = new ZendAfi_Controller_Action_Helper_View(); - $this->_helper = new ZendAfi_View_Helper_TagRechercheSimple(); - $this->_helper->setView($view); - - $this->_preferences = (new Class_Systeme_ModulesAccueil_RechercheSimple())->getDefaultValues(); - $this->fixture('Class_Zone', ['id' => 1, @@ -171,7 +161,6 @@ class ZendAfi_View_Helper_TagRechercheSimpleWithSessionParamsTest extends ViewHe ['id' => 2, 'libelle' => 'Europe']); - $this->fixture('Class_Zone', ['id' => 3, 'libelle' => 'US']); @@ -212,9 +201,9 @@ class ZendAfi_View_Helper_TagRechercheSimpleWithSessionParamsTest extends ViewHe 'visibilite' => 2]); $this->_preferences['select_bib'] = '1'; - } + /** @test */ public function searchButtonWithNoValueShouldBeEmptyValue() { $html = $this->_helper->tagRechercheSimple($this->_preferences, 1); @@ -230,6 +219,7 @@ class ZendAfi_View_Helper_TagRechercheSimpleWithSessionParamsTest extends ViewHe } + /** @test */ public function withSelectionBibShouldPostExpectedValue() { $this->_session->id_bibs = [1,2,3]; @@ -288,9 +278,6 @@ class ZendAfi_View_Helper_TagRechercheSimpleWithSessionParamsTest extends ViewHe /** @test */ public function withDomainPreferencesMultifacetCheckboxShouldBePresent() { - Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Catalogue') - ->whenCalled('saveThesaurus') - ->answers(null); $this->fixture('Class_Catalogue', ['id' => 4, 'libelle' => 'Adults']); @@ -301,17 +288,18 @@ class ZendAfi_View_Helper_TagRechercheSimpleWithSessionParamsTest extends ViewHe $this->fixture('Class_CodifThesaurus', ['id' => 4, - 'id_thesaurus' => 'CCCC0004', + 'id_thesaurus' => 'CCCC0002', 'id_origine' => 4, 'code' => 'Catalogue', - 'libelle' => 'Adults']); + 'libelle' => 'Youths']); $this->fixture('Class_CodifThesaurus', ['id' => 5, - 'id_thesaurus' => 'CCCC0005', + 'id_thesaurus' => 'CCCC0001', 'id_origine' => 5, 'code' => 'Catalogue', - 'libelle' => 'Youth']); + 'libelle' => 'Adults']); + $this->_preferences['domain_ids'] = 'a-4-5-b 1-'; $this->_preferences['domain_select_style'] = Class_Systeme_ModulesAccueil_RechercheSimple::DOMAIN_SELECT_CHECKBOX; @@ -326,9 +314,9 @@ class ZendAfi_View_Helper_TagRechercheSimpleWithSessionParamsTest extends ViewHe * @depends withDomainPreferencesMultifacetCheckboxShouldBePresent * @test */ - public function multifaceHCCCC0004ShouldBePresent($html) { + public function multifaceHCCCC0001ShouldBePresent($html) { $this->assertXPathContentContains($html, - '//label[preceding-sibling::input[@name="multifacet_HCCCC0004"]]', + '//label[preceding-sibling::input[@name="multifacet_HCCCC0001"]]', 'Adult'); } @@ -337,11 +325,31 @@ class ZendAfi_View_Helper_TagRechercheSimpleWithSessionParamsTest extends ViewHe * @depends withDomainPreferencesMultifacetCheckboxShouldBePresent * @test */ - public function multifaceHCCCC0005ShouldBePresent($html) { + public function multifaceHCCCC0002ShouldBePresent($html) { $this->assertXPathContentContains($html, - '//label[preceding-sibling::input[@name="multifacet_HCCCC0005"]]', + '//label[preceding-sibling::input[@name="multifacet_HCCCC0002"]]', 'Youth', $html); } } -?> \ No newline at end of file + + + +class ZendAfi_View_Helper_TagRechercheSimpleAdvancedSearchTest + extends ZendAfi_View_Helper_TagRechercheSimpleTestCase { + + public function datas() { + return [ [1], ['on'], ['1'] ]; + } + + /** + * @test + * @dataProvider datas + */ + public function shouldBeVisibleFor($value) { + $this->_preferences['recherche_avancee'] = $value; + $this->assertXPathContentContains($this->_helper->tagRechercheSimple($this->_preferences, 1), + '//a[contains(@href, "/recherche/avancee/statut/reset")]', + utf8_encode('Recherche avancée')); + } +} \ No newline at end of file