diff --git a/VERSIONS b/VERSIONS index 752745427743808ed93c4c969ff3f5877f3f2668..253029e98f216faaf5742e6959d50085f3192f4c 100644 --- a/VERSIONS +++ b/VERSIONS @@ -1,4 +1,28 @@ -06/02/2015 - v7.1.2 +12/02/2015 - v7.1.3 + + - ticket #20588: Correction des problèmes d'affichage dans la liste des suggestions. + + - ticket #20851: Ajout des métadonnées sur les articles pour les partages facebook. + + - ticket #18075: Les profils sont privés par héritage. L'accès à un profil privé via sa réécriture d'url fonctionne correctement. + + - ticket #20093: La sauvegarde de la configuration d'une boîte deux colonnes ne réinitialise plus les paramètres des boîtes déjà sélectionnées. + + - ticket #20607: Correction d'un bug dans cosmogramme qui empêchait l'intégration des nouveaux fichiers. + + - ticket #16604: Correction d'un bug dans la table stats_notices qui ne proposait pas de valeurs pas défaut dans les champs nb_visu et nb_resa. + + - ticket #18368: Sur la carte des zones, le lien vers le profil bibliothèque utilise le paramètre de profil rewrite_url si défini. + + - ticket #18372: Boîte sitothèque: ajout option ordre d'affichage aléatoire ou sélection. + + - ticket #18531: Correction du bug de duplication de profil. Lorsqu'on duplique une page ou un profil, le champ "url du profil/page" est vidé pour éviter les conflits. + + - ticket #18745: Correction de l'indexation des collections. + + + +06/02/2015 - v7.1.1 - v7.1.2 - ticket #16941: Modification du bouton Facebook pour s'adapter au nouveau fonctionnement de partage (Open Graph) diff --git a/application/modules/admin/controllers/AccueilController.php b/application/modules/admin/controllers/AccueilController.php index 4d4435354e6c95d6cf26dcf76cf479f39d636d67..de17d8ce4886e1f5502d4d8a8c9327ade917176c 100644 --- a/application/modules/admin/controllers/AccueilController.php +++ b/application/modules/admin/controllers/AccueilController.php @@ -360,7 +360,7 @@ class Admin_AccueilController extends Zend_Controller_Action { } $modules_accueil = Class_Systeme_ModulesAccueil::getModules(); - $modules = array(); + $modules = []; foreach ($modules_accueil as $key => $module) $modules[$key] = $module->getLibelle(); diff --git a/application/modules/admin/controllers/ProfilController.php b/application/modules/admin/controllers/ProfilController.php index 54e0c9795605427eccc78e914645fc12a2de738d..05ba269cdf5ff14d4cb76fec72cb3a6857979b37 100644 --- a/application/modules/admin/controllers/ProfilController.php +++ b/application/modules/admin/controllers/ProfilController.php @@ -298,8 +298,13 @@ class Admin_ProfilController extends ZendAfi_Controller_Action { public function deepcopyAction() { $copy = $this->_profil->deepCopy(); - $copy->save(); - $this->_redirect('admin/profil/edit/id_profil/'.$copy->getId()); + if ($copy->save()) { + $this->_redirect('admin/profil/edit/id_profil/'.$copy->getId()); + return; + } + + $this->_redirect('admin/profil'); + $this->_helper->notify($this->_('Duplication impossible: ').implode(',', $copy->getErrors())); } diff --git a/application/modules/admin/views/scripts/accueil/sitotheque.phtml b/application/modules/admin/views/scripts/accueil/sitotheque.phtml index 993fe967c0c0dd566132139ae717b089116bd934..6f3e6e4b36ce42286b67e6be95d80d2b42fa3771 100644 --- a/application/modules/admin/views/scripts/accueil/sitotheque.phtml +++ b/application/modules/admin/views/scripts/accueil/sitotheque.phtml @@ -2,20 +2,20 @@ <h1>Propriétés du module sitothèque</h1><br> <div class="formTable"> <form method="post" action="<?php echo $this->url ?>"> - + <fieldset> <legend>Affichage</legend> <table cellspacing="2"> - + <tr> <td class="droite">Style de boite </td> <td class="gauche"><?php echo $this->combo_templates ?></td> </tr> - + </table> </fieldset> <br> - + <fieldset> <legend>Généralités</legend> <table cellspacing="2"> @@ -26,37 +26,53 @@ </table> </fieldset> <br> - + <fieldset> <legend>Sites à afficher</legend> <table cellspacing="2" width="100%"> <tr> <td class="droite" width="90px">Type </td> <td class="gauche"> - <?php + <?php $onchange="$('.treeselect').treeselect('toggleVisibility', (this.value == '1'));"; echo $this->formSelect("type_aff", $this->preferences["type_aff"], array("onchange" => $onchange), array("1" => "Une sélection de catégories ou de sites", - "2" => "Les sites les plus récents")) + "2" => "Les sites les plus récents")) ?> </td> </tr> </table> - + <div id="table_selection"> - <?php + <?php echo $this->treeSelect( $this->preferences["id_items"], $this->preferences["id_categorie"], ($this->preferences["type_aff"] == "1"), BASE_URL.'/admin/bib/allitems?id_bib='.$this->id_bib.'&type=sito', "form"); - ?> + ?> </div> <table cellspacing="2" width="100%"> + + + <tr id='option_display_order'> + <td class="droite" width="90px">Ordre d'affichage </td> + <td class="gauche"> + <?php + echo $this->formRadio("display_order", + $this->preferences["display_order"], + [], + ['Random' => $this->_('Par ordre aléatoire'), + 'Selection' => $this->_('Par ordre de sélection')]); + ?> + </td> + </tr> + + <tr id='option_nb_aff'> <td class="droite" width="90px">Nbre à afficher </td> <td class="gauche"><input type="text" name="nb_aff" size="3" maxlength="3" value="<?php print($this->preferences["nb_aff"]); ?>"></td> @@ -66,17 +82,21 @@ <td class="droite" width="90px">Grouper par catégorie </td> <td class="gauche"> <?php - echo $this->formCheckbox('group_by_categorie', - null, + echo $this->formCheckbox('group_by_categorie', + null, array('checked' => $this->preferences["group_by_categorie"])); ?> </td> </tr> </table> - + </fieldset> <br /> - + <?php echo $this->formSubmit("Valider","Valider",array("class" => "bouton")) ?> </form> + + <script type="text/javascript"> + formSelectToggleVisibilityForElement("input[name=display_order]", "#option_nb_aff", "Random"); + </script> </div> diff --git a/application/modules/opac/controllers/CmsController.php b/application/modules/opac/controllers/CmsController.php index a2fc8413cf8c3a1a517a90b02e7755b3e7619eb1..d33e4b13e6faf9ac84cb4cd73bb0bd562b250467 100644 --- a/application/modules/opac/controllers/CmsController.php +++ b/application/modules/opac/controllers/CmsController.php @@ -117,6 +117,7 @@ class CmsController extends Zend_Controller_Action { $this->view->article = $article; $this->view->titreAdd($article->getTitre()); + Class_ScriptLoader::getInstance()->addCmsMeta($article); } diff --git a/cosmogramme/php/_init.php b/cosmogramme/php/_init.php index 13c63fc20199e6595d47513a44e322424e6131ef..27e4b084edeaea524c6306bdbd1a247e1cd6e998 100644 --- a/cosmogramme/php/_init.php +++ b/cosmogramme/php/_init.php @@ -1,7 +1,7 @@ <?php // Constantes error_reporting(E_ERROR | E_PARSE); -define("PATCH_LEVEL","230"); +define("PATCH_LEVEL","231"); define("APPLI","cosmogramme"); define("COSMOPATH", "/var/www/html/vhosts/opac2/www/htdocs"); diff --git a/cosmogramme/php/classes/classe_notice_integration.php b/cosmogramme/php/classes/classe_notice_integration.php index 462578625f42e40c47a018d02d120eb24d888568..16d52290440b283878afbc9c3afc7867b1d47dc7 100644 --- a/cosmogramme/php/classes/classe_notice_integration.php +++ b/cosmogramme/php/classes/classe_notice_integration.php @@ -537,7 +537,7 @@ class notice_integration { public function noticeToDBEnreg() { return [ "type_doc" => $this->notice["type_doc"], - "alpha_titre" => $this->notice["alpha_titre"], + "alpha_titre" => $this->notice["alpha_titre"], "alpha_auteur" => $this->notice["alpha_auteur"], "titres" => $this->indexation->getfullText(array_merge($this->notice["titres"], @@ -569,8 +569,9 @@ class notice_integration { } - private function updateNotice($id_notice, $qualite) { - $existing_notice = Class_Notice::find($id_notice); + public function updateNotice($id_notice, $qualite) { + if(!$existing_notice = Class_Notice::find($id_notice)) + return $id_notice; $this->notice["qualite"] = $existing_notice->getQualite(); $this->notice["facette"] = $existing_notice->getFacettes(); @@ -684,7 +685,7 @@ class notice_integration { } - private function ecrireExemplaires($id_notice) { + public function ecrireExemplaires($id_notice) { $code_barres = []; $exemplaires = []; foreach ($this->notice['exemplaires'] as $ex) { @@ -721,9 +722,8 @@ class notice_integration { foreach($exemplaires as $exemplaire) $exemplaire->save(); - Class_Notice::find($id_notice) - ->setDateMaj(dateDuJour(2)) - ->save(); + if($record = Class_Notice::find($id_notice)) + $record->setDateMaj(dateDuJour(2))->save(); Class_Exemplaire::clearCache(); Class_Notice::clearCache(); diff --git a/cosmogramme/sql/patch/patch_231.php b/cosmogramme/sql/patch/patch_231.php new file mode 100644 index 0000000000000000000000000000000000000000..946bf2185abd01fdee297e0f355122ed9de13279 --- /dev/null +++ b/cosmogramme/sql/patch/patch_231.php @@ -0,0 +1,5 @@ +<?php +$adapter = Zend_Registry::get('sql') +$adapter->query('ALTER TABLE stats_notices MODIFY nb_visu int(11) default 0'); +$adapter->query('ALTER TABLE stats_notices MODIFY nb_resa int(11) default 0'); +?> diff --git a/cosmogramme/tests/php/classes/NoticeIntegrationTest.php b/cosmogramme/tests/php/classes/NoticeIntegrationTest.php index 488882d7683ddedea1758197019430e128bdba61..dce95e10e9601cf629e4911a5b51f6053d80d814 100644 --- a/cosmogramme/tests/php/classes/NoticeIntegrationTest.php +++ b/cosmogramme/tests/php/classes/NoticeIntegrationTest.php @@ -1171,6 +1171,38 @@ class NoticeIntegrationKohaBadUnimarcTest extends NoticeIntegrationTestCase { +class NoticeIntegrationKohaBdMilleniumTest extends NoticeIntegrationTestCase { + public function getProfilDonnees() { + return Class_IntProfilDonnees::forKoha()->getRawAttributes(); + } + + + public function setUp() { + parent::setUp(); + $this->loadNotice('unimarc_bd_millenium'); + $this->millenium = Class_Notice::find(1); + } + + /** @test */ + public function titreShouldBeHommesQuiNaimaientPasLesFemmes() { + $this->assertEquals('Les hommes qui n\'aimaient pas les femmes', $this->millenium->getTitrePrincipal()); + } + + + /** @test */ + public function collectionShouldContainsMillenium() { + $this->assertContains('Millenium', $this->millenium->getCollections()); + } + + /** @test */ + public function collectionMilleniumShouldBeIndexed() { + $this->assertEquals('MILLENIUM MILENIUM', $this->millenium->getRawAttributes()['collection']); + } +} + + + + class NoticeIntegrationKohaUnimarcWithoutLabelBlocTest extends NoticeIntegrationTestCase { public function getProfilDonnees() { return Class_IntProfilDonnees::forKoha()->getRawAttributes(); @@ -2139,7 +2171,7 @@ class NoticeIntegrationLeChatonDansLaSouriciereTest extends NoticeIntegrationTes /** @test */ public function collectionShouldBeMiniSourisNoire() { - $this->assertEquals('Mini souris noire', $this->_notice->getCollection()[0]); + $this->assertEquals('Mini souris noire', $this->_notice->getCollections()[0]); } @@ -2277,4 +2309,30 @@ class NoticeIntegrationPommeDeReinetteTest extends NoticeIntegrationTestCase { } -?> \ No newline at end of file + + +class NoticeIntegrationNoNoticeTest extends NoticeIntegrationTestCase { + public function tearDown() { + Storm_Model_Loader::defaultToDb(); + parent::tearDown(); + } + + + public function setUp() { + parent::setUp(); + Storm_Model_Loader::defaultToVolatile(); + $this->_notice_integration = new notice_integration(); + } + + + /** @test */ + public function updateNoticeShouldNotCrash() { + $this->assertEquals(1, $this->_notice_integration->updateNotice(1,5)); + } + + + /** @test */ + public function writeItemShouldNotCrash() { + $this->assertNull($this->_notice_integration->ecrireExemplaires(1)); + } +} \ No newline at end of file diff --git a/cosmogramme/tests/php/classes/unimarc_bd_millenium.txt b/cosmogramme/tests/php/classes/unimarc_bd_millenium.txt new file mode 100644 index 0000000000000000000000000000000000000000..e1d61aeb811df8583babce2f4be217a8ffa013b1 --- /dev/null +++ b/cosmogramme/tests/php/classes/unimarc_bd_millenium.txt @@ -0,0 +1 @@ +01290 2200289 4500001000700000010002400007035002100031073001800052090001900070091000900089099000700098100004100105101000800146102000700154106000600161200019000167210004300357215006700400225001700467700004500484701002200529702004300551801006700594995010900661995012100770995010900891260265 a9782800157771brel. a(OCoLC)868591687 1a9782800157771 9260265a260265 a2c1 tBD a20140318 frey50 afre aFR ar1 aLes hommes qui n'aimaient pas les femmesbTexte impriméeseconde partiefscénario, Sylvain Runberggdessin, José Homsgd'après la trilogie de Stieg LarssonhTome 2hseconde partie aPariscDupuisd2013eimpr. en Belgique a1 vol. (64 p.)ctout ill. en coul., couv. ill. en coul.d32 cm aMilleniumv2 9495032aRunbergbSylvainf1971-....4690 9485177aHoms4440 9545077aLarssonbStiegf1954-20044100 3gAFNORaFRbMediatheque intercommunale Ouest Provencec20140225 f31301011644247m2014-07-0840009492216bFOS20kBD RUN62014-03-11o0cLLv14.50rBDaFOSeL1l00qNL4 f31301011644122m2014-10-0440009492217bMIR20kBD RUN62014-03-11n2014-10-25o0cLLv14.50rBDaMIReL1l00qNL4 f31301011644189m2014-10-1040009492218bENT20kBD RUN62014-03-11o0cLLv14.50rBDaENTeL1l00qNL4 \ No newline at end of file diff --git a/library/Class/Bib.php b/library/Class/Bib.php index 11357f4840092928b25df64979567f35977385c2..91c7f391fdadff86d925f080c23fc09ae5d4c838 100644 --- a/library/Class/Bib.php +++ b/library/Class/Bib.php @@ -248,23 +248,24 @@ class Class_Bib extends Storm_Model_Abstract { public function getAffZoneAsArray() { if (!$aff_zone = ZendAfi_Filters_Serialize::unserialize($this->getAffZone())) - $aff_zone = array('profilID' => null, + $aff_zone = []; + + return array_merge(['profilID' => null, 'libelle' => '', 'posX' => 0, 'posY' => 0, - 'posPoint' => ''); - return $aff_zone; + 'posPoint' => ''], + $aff_zone); } public function getUrl() { $props = $this->getAffZoneAsArray(); - if (array_isset("profilID", $props) and (1 < ($profilID = $props["profilID"]))) // mode moulins => adresse du profil précisé en config - return sprintf("%s?id_profil=%d",BASE_URL, $profilID); - - return sprintf("%s/bib/bibview/id/%d", - BASE_URL, - $this->getId()); //mode calice => pointe vers la bib + $profil = Class_Profil::find($props["profilID"]); + $parts = $profil ? $profil->getUrlParts() : ['controller' => 'bib', + 'action' => 'bibview', + 'id' => $this->getId()]; + return Class_Url::assemble($parts, null, true); } @@ -384,39 +385,6 @@ class Class_Bib extends Storm_Model_Abstract { } - // Lire les bibs par une id_zone =============== OLD FONCTION ========= - - public function getAllBibByIdZone($id_zone=0) - { - try - { - $BibCSite = new BibCSite(); - if($id_zone == 0) - { - $select = $BibCSite->getAdapter()->select() - ->from('bib_c_site',array('ID_SITE'=>'ID_SITE','LIBELLE'=>'LIBELLE', 'ID_ZONE'=>'ID_ZONE','VILLE'=>'VILLE','MAIL'=>'MAIL','URL_WEB'=>'URL_WEB','TELEPHONE'=>'TELEPHONE','VISIBILITE'=>'VISIBILITE')) - ->where('ID_ZONE >=?', 0) - ->order('VILLE'); - $stmt = $select->query(); - $row = $stmt->fetchAll(); - return $row; - } - else - { - $select = $BibCSite->getAdapter()->select() - ->from('bib_c_site',array('ID_SITE'=>'ID_SITE','LIBELLE'=>'LIBELLE', 'ID_ZONE'=>'ID_ZONE','VILLE'=>'VILLE','MAIL'=>'MAIL','URL_WEB'=>'URL_WEB','TELEPHONE'=>'TELEPHONE','VISIBILITE'=>'VISIBILITE')) - ->where('ID_ZONE=?', $id_zone) - ->order('VILLE'); - $stmt = $select->query(); - $row = $stmt->fetchAll(); - return $row; - } - }catch (Exception $e) - { - logErrorMessage('Class: Class_Zone; Function: getAllBibByIdZone' . NL . $e->getMessage()); - return $this->_dataBaseError; - } - } public function getBibById($id_bib) { diff --git a/library/Class/Exemplaire.php b/library/Class/Exemplaire.php index cdafaf371c295f16560cdba1926e43fa9bcda1dd..4d6e43ad537cb036b57ee4c6ecbc9eb4f0c09274 100644 --- a/library/Class/Exemplaire.php +++ b/library/Class/Exemplaire.php @@ -137,7 +137,7 @@ class Class_Exemplaire extends Storm_Model_Abstract { public function getCollectionPrincipale() { - return $this->getNotice()->getCollection(true); + return $this->getNotice()->getCollections(true); } diff --git a/library/Class/IntProfilDonnees.php b/library/Class/IntProfilDonnees.php index 819fa1b8312d0c7dc1f7fb42832abdafd270f377..775b33a871bda7f0517650ca4cbdc735da9adda8 100644 --- a/library/Class/IntProfilDonnees.php +++ b/library/Class/IntProfilDonnees.php @@ -94,6 +94,45 @@ class Class_IntProfilDonnees extends Storm_Model_Abstract { } + public static function forOrphee() { + return self:: + newInstance(['libelle' => 'Unimarc Orphée', + 'accents' => self::ENCODING_ISO2709, + 'rejet_periodiques' => '0', + 'id_article_periodique' => self::SERIAL_FORMAT_ORPHEE, + 'type_fichier' => self::FT_RECORDS, + 'format' => self::FORMAT_UNIMARC, + 'attributs' => + [['type_doc' => + [[ 'code' => '0', 'label' => '', 'zone_995' => '' ], + [ 'code' => '1', 'label' => 'am;na', 'zone_995' => 'au;uu;iu;LIV;MS' ], + [ 'code' => '2', 'label' => 'as', 'zone_995' => 'PER'], + [ 'code' => '3', 'label' => 'i;j', 'zone_995' => 'jz;CD;LIVCD;LIVK7;K7'], + [ 'code' => '4', 'label' => 'g', 'zone_995' => 'gz;DIAPO;DVD;VHS;VHD;VD'], + [ 'code' => '5', 'label' => 'l;m', 'zone_995' => 'lu;CDR'], + [ 'code' => '6', 'label' => '', 'zone_995' => 'DOS' ], + [ 'code' => '7', 'label' => '', 'zone_995' => '' ], + [ 'code' => '8', 'label' => '', 'zone_995' => 'WEB;MF'] + ], + 'champ_code_barres' => 'a', + 'champ_cote' => 'f', + 'champ_type_doc' => 'c', + 'champ_genre' => '', + 'champ_section' => 'w', + 'champ_emplacement' => 'x', + 'champ_annexe' => 'g' + ], + ['zone' => '995', + 'champ' => '5', + 'format' => self::NOVELTY_DATE_FORMAT_VALUES, + 'jours' => '', + 'valeurs' => '1'] + ] + ] + ); + } + + public static function forALOES() { $type_doc = [['code' => '0', 'label' => '', 'zone_995' => ''], ['code' => '1', 'label' => 'am;na', 'zone_995' => 'LIV;MS;az'], diff --git a/library/Class/Notice.php b/library/Class/Notice.php index 848eb238f03526afaf1cc27b626c25641d242f28..c1e07ab49c76d321b67db7335642221924226dc1 100644 --- a/library/Class/Notice.php +++ b/library/Class/Notice.php @@ -504,7 +504,7 @@ class Class_Notice extends Storm_Model_Abstract { case "A": $notice["A"] = $this->getAuteurPrincipal(); break; case "E": $notice["E"] = $this->getEditeur(); break; case "F": $notice["F"] = $this->getCentreInteret(); break; - case "C": $notice["C"] = $this->getCollection(true); break; + case "C": $notice["C"] = $this->getCollections(true); break; case "O": $notice["O"] = $this->getNotes(); break; case "R": $notice["R"] = $this->getResume(); break; case "U": $notice["U"] = $unimarc; break; @@ -615,7 +615,7 @@ class Class_Notice extends Storm_Model_Abstract { case Class_CodifAuteur::CODE_FACETTE: return $this->getAuteursUnimarc(false, true); case Class_Codification::CODE_TITRE: return $this->getZonesTitre(); case Class_Codification::CODE_EDITEUR: return $this->getEditeur(); - case Class_Codification::CODE_COLLECTION: return $this->getCollection(true); + case Class_Codification::CODE_COLLECTION: return $this->getCollections(true); case Class_Codification::CODE_NOTES: return $this->getNotes(); case Class_Codification::CODE_COLLATION: return $this->getCollation(); case Class_Codification::CODE_RESUME: return $this->getResume(); @@ -1174,7 +1174,7 @@ class Class_Notice extends Storm_Model_Abstract { } - public function getCollection($principale=false) { + public function getCollections($principale=false) { if (!$data = $this->get_subfield(225, "a")) $data = $this->get_subfield(410, "t"); if(!$data) $data = []; @@ -1523,7 +1523,7 @@ class Class_Notice extends Storm_Model_Abstract { $enreg .= $this->getTitrePrincipal().$sep; $enreg .= $this->getAuteurPrincipal().$sep; $enreg .= $this->getEditeur().$sep; - $enreg .= implode(',', $this->getCollection()).$sep; + $enreg .= implode(',', $this->getCollections()).$sep; $enreg .= $this->getAnnee().chr(10); return $enreg; diff --git a/library/Class/Profil.php b/library/Class/Profil.php index cd9b9ac39a9205444669899749e57201081947ba..55bd1bc50c31c8a135517dc6d1bc73fdcbfb7b1e 100644 --- a/library/Class/Profil.php +++ b/library/Class/Profil.php @@ -519,6 +519,21 @@ class Class_Profil extends Storm_Model_Abstract { } + public function getUrlParts() { + if (!$this->hasRewriteUrl()) + return ['id_profil' => $this->getId()]; + + if (!$this->hasParentProfil()) + return ['module' => $this->getRewriteUrl()]; + + if (!$this->getParentProfil()->hasRewriteUrl()) + return ['module' => $this->getRewriteUrl()]; + + return ['module' => $this->getParentProfil()->getRewriteUrl(), + 'controller' => $this->getRewriteUrl()]; + } + + /** * @param int $start_id * @return int @@ -549,7 +564,6 @@ class Class_Profil extends Storm_Model_Abstract { : ['type_module' => $type_module, 'preferences' => Class_Systeme_ModulesAccueil::getInstance()->getValeursParDefaut($type_module)]; - if ($this->isModulePreferencesSharedBetweenProfils($module, $type_module)) return $this->getModuleAccueilConfigByType($type_module, self::DIV_BANNIERE); @@ -579,7 +593,7 @@ class Class_Profil extends Storm_Model_Abstract { $default_prefs = array_merge($default_prefs, ['id_module' => $id_module]); $module['preferences'] = (!array_isset('preferences', $module)) ? - $default_prefs : array_merge($default_prefs, $module['preferences']); + $default_prefs : array_merge($default_prefs, array_filter($module['preferences'])); return $module; } @@ -1198,7 +1212,22 @@ class Class_Profil extends Storm_Model_Abstract { * @return bool */ public function isPublic() { - return (int)$this->getAccessLevel() === -1; + $access_level = (int)$this->getAccessLevel(); + if($this->hasParentProfil() && $access_level === -1) + return $this->getParentProfil()->isPublic(); + return $access_level === -1; + } + + + public function getAccessLevel() { + if($access_level = parent::getAccessLevel()) + return $access_level; + + if(!$parent_profil = $this->getParentProfil()) + return $access_level; + + return $parent_profil->getAccessLevel(); + } @@ -1484,6 +1513,7 @@ class Class_Profil extends Storm_Model_Abstract { $attributes = $this->_attributes; unset($attributes['id']); unset($attributes['id_profil']); + unset($attributes['rewrite_url']); return $copy ->updateAttributes($attributes) @@ -1902,23 +1932,47 @@ class Class_Profil extends Storm_Model_Abstract { public function getModuleTitle($id_module) { - if(! $cfg_accueil = $this->getCfgAccueilAsArray()) + if(!array_key_exists('titre', ($pref_module = $this->getModulePref($id_module)))) return ''; - if(! array_key_exists($id_module, $cfg_accueil['modules'])) - return ''; + return $pref_module['titre']; + } - $module = $cfg_accueil['modules'][$id_module]; - if(! array_key_exists('preferences', $module)) - return ''; + public function getModulePref($id_module) { + if(! array_key_exists('preferences', ($module = $this->getLocalModuleAccueilConfig($id_module)))) + return []; + + return $module['preferences']; - $pref_module = $module['preferences']; + } - if(!array_key_exists('titre', $pref_module)) - return ''; - return $pref_module['titre']; + public function getModules() { + if(!$cfg_accueil = $this->getCfgAccueilAsArray()) + return []; + + if(! array_key_exists('modules', $cfg_accueil)) + return []; + + return $cfg_accueil['modules']; + } + + + public function getModuleIdFromCol($id, $type_module, $colonne) { + $modules = $this->getModules(); + if(!$two_cols_pref = $this->getModulePref($id)) + return ''; + + $keys = []; + foreach($modules as $key => $module) { + if( $module['type_module'] == $type_module + && $module['parent_id'] == $id + && $key >= 1000 + && $key == $two_cols_pref['col_' . $colonne . '_module_id']) + return $key; + } + return ''; } } ?> diff --git a/library/Class/ScriptLoader.php b/library/Class/ScriptLoader.php index ea35782c0b12f6f88f30b6263c2de7c03f47cbf8..adf9eeba2a763973a742134d54049a17b05dee2b 100644 --- a/library/Class/ScriptLoader.php +++ b/library/Class/ScriptLoader.php @@ -741,6 +741,13 @@ class Class_ScriptLoader { } + public function addCmsMeta($article) { + $this->_metas[] = '<meta property="og:title" content="' . $article->getTitre() . '" />'; + $this->_metas[] = '<meta property="og:description" content="' . $article->getSummary() . '" />'; + return $this; + } + + public function loadMeta() { echo implode('',$this->_metas); return $this; diff --git a/library/Class/Systeme/ModulesAccueil/ConteneurDeuxColonnes.php b/library/Class/Systeme/ModulesAccueil/ConteneurDeuxColonnes.php index 62faf5a2d0eab508df3af66b34817882e6e24774..107cb95a03745ced359177afe5ae38494eec2792 100644 --- a/library/Class/Systeme/ModulesAccueil/ConteneurDeuxColonnes.php +++ b/library/Class/Systeme/ModulesAccueil/ConteneurDeuxColonnes.php @@ -51,12 +51,9 @@ class Class_Systeme_ModulesAccueil_ConteneurDeuxColonnes extends Class_Systeme_M $type_module = $preferences[$type_key]; $profil = Class_Profil::getCurrentProfil(); - $id_module = $profil->createNewModuleAccueilId(1000); + $id_module = self::getOrCreateModuleForCol($profil, $parent_id, $type_module, $colonne); - $modules_accueil = new Class_Systeme_ModulesAccueil(); - $preferences = $modules_accueil->getValeursParDefaut($type_module); - - $config = ['preferences' => $preferences, + $config = ['preferences' => self::getOrCreateModulePref($profil, $id_module, $type_module), 'type_module' => $type_module, 'parent_id' => $parent_id]; @@ -72,5 +69,19 @@ class Class_Systeme_ModulesAccueil_ConteneurDeuxColonnes extends Class_Systeme_M return $id_module; } + + + public static function getOrCreateModuleForCol($profil, $id, $type_module, $colonne) { + if(!$id = $profil->getModuleIdFromCol($id, $type_module, $colonne)) + return $profil->createNewModuleAccueilId(1000); + return $id; + } + + + public static function getOrCreateModulePref($profil, $id_module, $type_module) { + if(!$pref = $profil->getModulePref($id_module)) + return (new Class_Systeme_ModulesAccueil())->getValeursParDefaut($type_module); + return $pref; + } } ?> \ No newline at end of file diff --git a/library/Class/Systeme/ModulesAccueil/DomainBrowser.php b/library/Class/Systeme/ModulesAccueil/DomainBrowser.php index d5048065b2f3c93429dc3a9c97de710e5fdbb1d4..c1d4e173d8a88d785b4ab9eaf25272bda697784e 100644 --- a/library/Class/Systeme/ModulesAccueil/DomainBrowser.php +++ b/library/Class/Systeme/ModulesAccueil/DomainBrowser.php @@ -16,12 +16,12 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ class Class_Systeme_ModulesAccueil_DomainBrowser extends Class_Systeme_ModulesAccueil_Null{ - + protected $_group = Class_Systeme_ModulesAccueil::GROUP_RECH; protected $_libelle = 'Domaines'; @@ -34,6 +34,7 @@ class Class_Systeme_ModulesAccueil_DomainBrowser extends Class_Systeme_ModulesAc protected $_popupHeight = 700; protected $_defaultValues = ['titre' => 'Domaines', + 'allow_breadcrumb' => 0, 'root_domain_id' => 0, 'display_mode' => Class_Systeme_ModulesAppli::LISTE_FORMAT_ACCORDEON]; diff --git a/library/Class/Systeme/ModulesAccueil/Sitotheque.php b/library/Class/Systeme/ModulesAccueil/Sitotheque.php index d8f54fb9c236d15c393e6159ac6d2dec6fc49382..943e06fd591cf2f5383c918e0c582e0b6565eba1 100644 --- a/library/Class/Systeme/ModulesAccueil/Sitotheque.php +++ b/library/Class/Systeme/ModulesAccueil/Sitotheque.php @@ -16,12 +16,12 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ class Class_Systeme_ModulesAccueil_Sitotheque extends Class_Systeme_ModulesAccueil_Null{ /** @var string */ protected $_group = Class_Systeme_ModulesAccueil::GROUP_INFO; - + /** @var string */ protected $_libelle = 'Sitothèque'; @@ -44,7 +44,8 @@ class Class_Systeme_ModulesAccueil_Sitotheque extends Class_Systeme_ModulesAccue 'id_categorie' => '', // Liste d'id_categorie séparés par des tirets 'id_items' => '', // Liste d'id_site séparés par des tirets 'nb_aff' => '2', // Nombre à afficher - 'group_by_categorie' => false //grouper les sites par categorie sous forme de menu + 'group_by_categorie' => false, //grouper les sites par categorie sous forme de menu, + 'display_order' => 'Random' //ordre d'affichage: Random ou Selection ); } ?> \ No newline at end of file diff --git a/library/Class/Systeme/ModulesMenu/Profil.php b/library/Class/Systeme/ModulesMenu/Profil.php index 2c62fde404dc979ccd8918976062c0594641aace..6bb005ce0df01b4763dd623b01089580f56ad87d 100644 --- a/library/Class/Systeme/ModulesMenu/Profil.php +++ b/library/Class/Systeme/ModulesMenu/Profil.php @@ -48,17 +48,7 @@ class Class_Systeme_ModulesMenu_Profil extends Class_Systeme_ModulesMenu_Null{ if (!$profil = Class_Profil::find($preferences['clef_profil'])) return []; - if (!$profil->hasRewriteUrl()) - return ['id_profil' => $profil->getId()]; - - if (!$profil->hasParentProfil()) - return ['module' => $profil->getRewriteUrl()]; - - if (!$profil->getParentProfil()->hasRewriteUrl()) - return ['module' => $profil->getRewriteUrl()]; - - return ['module' => $profil->getParentProfil()->getRewriteUrl(), - 'controller' => $profil->getRewriteUrl()]; + return $profil->getUrlParts(); } } ?> \ No newline at end of file diff --git a/library/ZendAfi/Controller/Plugin/DefineURLs.php b/library/ZendAfi/Controller/Plugin/DefineURLs.php index 3dacd872909e2840d3a573927c57b1970414e17d..ed6387cb21aec751e59824b8be8facb12a2304a8 100644 --- a/library/ZendAfi/Controller/Plugin/DefineURLs.php +++ b/library/ZendAfi/Controller/Plugin/DefineURLs.php @@ -16,7 +16,7 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ ////////////////////////////////////////////////////////////////////////////////////////// // OPAC3 : Activation du profil et du skin @@ -33,7 +33,7 @@ class ZendAfi_Controller_Plugin_DefineURLs extends Zend_Controller_Plugin_Abstra $module = $this->getModuleNameForProfilAndRequest($profil, $request); $profil->setSkin($request->getParam('skin',$profil->getSkin())); $this->setUpSkin($module, $profil); - + if ($module=="admin") $this->setUpBibZoneFilters($request); @@ -46,29 +46,26 @@ class ZendAfi_Controller_Plugin_DefineURLs extends Zend_Controller_Plugin_Abstra public function findProfilTelephoneId() { - if (!$profil = Class_Profil::getLoader()->findFirstBy(array('BROWSER' => 'telephone'))) + if (!$profil = Class_Profil::getLoader()->findFirstBy(array('BROWSER' => 'telephone'))) return 0; return $profil->getId(); } - - public function selectProfilFromRequest($request) { - $requested_module = $request->getModuleName(); - // Initialisation du profil - $id_profil = ($requested_module === 'admin') ? 0 : (int)$request->getParam('id_profil'); - - if ($id_profil <= 0 && ($this->_session->id_profil) && ($requested_module !== 'telephone')) + protected function selectProfilFromRequest($request) { + $id_profil = $this->getIdProfilFromRequest($request); + + if ($id_profil <= 0 && ($this->_session->id_profil) && ($request->getModuleName() !== 'telephone')) $id_profil = intval($this->_session->id_profil); - + if ($id_profil <= 0 && $this->shouldSelectTelephone($request)) $id_profil = $this->findProfilTelephoneId(); if ($id_profil <= 0) $id_profil = 1; - - if (!$profil = Class_Profil::getLoader()->find($id_profil)) - $profil = Class_Profil::getLoader()->findFirstBy(array('order' => 'id_profil')); + + if (!$profil = Class_Profil::find($id_profil)) + $profil = Class_Profil::findFirstBy(['order' => 'id_profil']); $this->_session->id_profil = $profil->getId(); @@ -76,31 +73,43 @@ class ZendAfi_Controller_Plugin_DefineURLs extends Zend_Controller_Plugin_Abstra } - public function memorizeLastProfil() { + protected function getIdProfilFromRequest($request) { + if($request->getModuleName() === 'admin') + return 0; + + if (!$profil = Class_Profil::findFirstBy(['rewrite_url' => $request->getControllerName()])) + return (int)$request->getParam('id_profil', 0); + + return $profil->getId(); + } + + + protected function memorizeLastProfil() { $this->_session->previous_id_profil = isset($this->_session->id_profil) ? $this->_session->id_profil : 1; return $this; } - public function getModuleNameForProfilAndRequest($profil, $request) { + protected function getModuleNameForProfilAndRequest($profil, $request) { $module = $requested_module = $request->getModuleName(); if (('telephone' == $profil->getBrowser()) && ($requested_module != 'admin')) $module = 'telephone'; if ($requested_module == 'telephone' && $profil->getBrowser() == 'opac') $module = 'opac'; - + /** * Si l'ouverture du profil nécessite un niveau d'accès et que * le niveau requis est trop faible, on redirige sur la page de login - */ + */ if (!$profil->isPublic()) { $auth = ZendAfi_Auth::getInstance(); if (!$auth->hasIdentity() or $auth->getIdentity()->ROLE_LEVEL < $profil->getAccessLevel()) { if ($module != 'admin' && !$auth->hasIdentity()) { $redirect = '?redirect=' . urlencode('/index/index/id_profil/' . $profil->getId()); - $this->getResponse()->setRedirect(BASE_URL . '/auth/login/id_profil/1' . $redirect); + return $this->getResponse()->setRedirect(BASE_URL . '/auth/login/id_profil/1' . $redirect); } + $request->setControllerName('auth'); $request->setActionName('login'); } @@ -111,7 +120,7 @@ class ZendAfi_Controller_Plugin_DefineURLs extends Zend_Controller_Plugin_Abstra } - public function setUpSkin($module, $profil) { + protected function setUpSkin($module, $profil) { $skindir = $profil->getPathTheme(); $url_skin = BASE_URL . $skindir; @@ -119,10 +128,10 @@ class ZendAfi_Controller_Plugin_DefineURLs extends Zend_Controller_Plugin_Abstra } - public function setUpBibZoneFilters($request) { + protected function setUpBibZoneFilters($request) { if (!array_key_exists('admin', $_SESSION)) - $_SESSION["admin"] = array("filtre_localisation" => array("id_zone" => 'ALL', - "id_bib" => 'ALL')); + $_SESSION['admin'] = ['filtre_localisation' => ['id_zone' => 'ALL', + 'id_bib' => 'ALL']]; $session=$_SESSION["admin"]["filtre_localisation"]; diff --git a/library/ZendAfi/Form/Configuration/FormationsWidget.php b/library/ZendAfi/Form/Configuration/FormationsWidget.php index cf5950347b4f51719a36c7bbd261dccfa9cef7d5..d28c0d01e513534195a377f2eb718a577c164654 100644 --- a/library/ZendAfi/Form/Configuration/FormationsWidget.php +++ b/library/ZendAfi/Form/Configuration/FormationsWidget.php @@ -23,9 +23,12 @@ class ZendAfi_Form_Configuration_FormationsWidget extends ZendAfi_Form { public static function newWith($module_settings = [], $custom_form = null) { $form = new self(); + + $selected_formations = array_key_exists('selected_formations', $module_settings) ? $module_settings['selected_formations'] : ''; + $form ->populate($module_settings) - ->addToWith('formations_selector', $module_settings['selected_formations']) + ->addToWith('formations_selector', $selected_formations) ->addDisplayGroup(['titre', 'boite'], 'Base', diff --git a/library/ZendAfi/View/Helper/Accueil/Sito.php b/library/ZendAfi/View/Helper/Accueil/Sito.php index 12d97eb6dae6fe6238093b5b1178905fdee1d034..d464440a47955463750f933dd0a592c5dd6702d2 100644 --- a/library/ZendAfi/View/Helper/Accueil/Sito.php +++ b/library/ZendAfi/View/Helper/Accueil/Sito.php @@ -34,35 +34,40 @@ class ZendAfi_View_Helper_Accueil_Sito extends ZendAfi_View_Helper_Accueil_Base public function getHtml() { extract($this->preferences); $contenu = ''; + $nb_aff = $this->preferences['nb_aff']; + if ($this->isTypeAffichageSelection()) { $sites = Class_Sitotheque::getSitesFromIdsAndCategories( - explode('-', $id_items), - explode('-', $id_categorie)); + explode('-', $this->preferences['id_items']), + explode('-', $this->preferences['id_categorie'])); - shuffle($sites); - $contenu.=$this->renderSitesSlice($sites,$nb_aff); - $titre= sprintf('<a href="%s" title="%s">%s</a>', + if ($this->preferences['display_order'] == 'Random') + shuffle($sites); + + if ($this->preferences['display_order'] == 'Selection') + $nb_aff = count($sites); + + $titre = sprintf('<a href="%s" title="%s">%s</a>', htmlspecialchars(BASE_URL.'/opac/sito/viewselection/id_module/'.$this->id_module), $this->translate()->_('Sélection de sites'), $titre); } if ($this->isTypeAffichagePlusRecents() && $nb_aff > 0) { - $last_sito = Class_Sitotheque::getLoader()->findAllBy(array('limit' => 50)); - shuffle($last_sito); + $sites = Class_Sitotheque::findAllBy(['limit' => 50]); + shuffle($sites); if(!$titre) $titre = $this->translate()->_("Derniers sites ajoutés"); - $titre= sprintf('<a href="%s" title="%s">%s</a>', + $titre = sprintf('<a href="%s" title="%s">%s</a>', htmlspecialchars(BASE_URL.'/opac/sito/viewrecent/nb/50'), $this->translate()->_('Liste des derniers sites ajoutés'), $titre); - $contenu.=$this->renderSitesSlice($last_sito,$nb_aff); } - $this->titre=$titre; - $this->contenu = $contenu; + $this->titre = $titre; + $this->contenu = $this->renderSitesSlice($sites, $nb_aff); return $this->getHtmlArray(); } @@ -103,8 +108,7 @@ class ZendAfi_View_Helper_Accueil_Sito extends ZendAfi_View_Helper_Accueil_Base $sites = array_slice($sites, 0, $nb_aff); if (!$this->isGroupByCategorie()) - return $this->renderSites($sites, - '<div style="clear:both;width:100%;background:transparent url('.URL_IMG.'box/menu/separ.gif) repeat-x scroll center bottom;margin-bottom:5px"> </div>'); + return $this->renderSites($sites); $categories = $this->groupSitesByCategorie($sites); $htmls = array(); @@ -118,12 +122,8 @@ class ZendAfi_View_Helper_Accueil_Sito extends ZendAfi_View_Helper_Accueil_Base } - protected function renderSites($sites, $separator = '') { - $htmls = array(); - foreach($sites as $site) - $htmls []= $this->renderSite($site); - - return implode($separator, $htmls); + protected function renderSites($sites) { + return implode('', array_map([$this, 'renderSite'], $sites)); } diff --git a/library/ZendAfi/View/Helper/FormRadioButtons.php b/library/ZendAfi/View/Helper/FormRadioButtons.php index 0b90e5059ab0b6b1df60d7508830e2f9a5a465fc..8bad085513bc27ea3a13cf5b97175b2655ece4a7 100644 --- a/library/ZendAfi/View/Helper/FormRadioButtons.php +++ b/library/ZendAfi/View/Helper/FormRadioButtons.php @@ -16,7 +16,7 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ ////////////////////////////////////////////////////////////////////////////////////////////////////// // OPAC3 - Build radio buttons @@ -24,8 +24,8 @@ /* Exemple d'utilisation: - echo $this->formRadioButtons("display_order", - $this->preferences["display_order"], + echo $this->formRadioButtons("display_order", + $this->preferences["display_order"], array( "selection" => "Par ordre de sélection", "creation_date_desc" => "Par date de création (plus récent en premier)", @@ -38,12 +38,12 @@ class ZendAfi_View_Helper_FormRadioButtons extends ZendAfi_View_Helper_BaseHelpe $html = ''; $all_options = array_keys($buttons_description_dict); - if (! in_array($option_value, $all_options)) + if (! in_array($option_value, $all_options)) $option_value = $all_options[0]; foreach ($buttons_description_dict as $value => $label){ $checked = ($value == $option_value) ? "checked='checked'" : ""; - $html .= '<input type="radio" class="'.$option_name.'"name="'.$option_name.'" value="'.$value.'" '.$checked.' >'.$label.'<br/>'; + $html .= '<input type="radio" class="'.$option_name.'" name="'.$option_name.'" value="'.$value.'" '.$checked.' >'.$label.'<br/>'; } return $html; diff --git a/library/ZendAfi/View/Helper/SuggestionAchat.php b/library/ZendAfi/View/Helper/SuggestionAchat.php index 7d6f90abaacfb4c3d8c8091255f471566df0438e..d108b284cbe609b13ff3b6e6a18eab1b30a0c195 100644 --- a/library/ZendAfi/View/Helper/SuggestionAchat.php +++ b/library/ZendAfi/View/Helper/SuggestionAchat.php @@ -16,15 +16,15 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ class ZendAfi_View_Helper_SuggestionAchat extends ZendAfi_View_Helper_BaseHelper { - + public function suggestionAchat($suggestion_achat) { - $html = '<dl>'; + $html = '<br /><dl>'; $attributes = [$this->view->_('Date de création') => $suggestion_achat->getDateCreation(), $this->view->_('Type de document') => $suggestion_achat->getDocumentType(), $this->view->_('Titre') => $suggestion_achat->getTitre(), @@ -34,11 +34,11 @@ class ZendAfi_View_Helper_SuggestionAchat extends ZendAfi_View_Helper_BaseHelper $this->view->_('Commentaire') => $suggestion_achat->getCommentaire()]; foreach($attributes as $libelle => $value) { - $html.= + $html.= '<dt>'.$libelle.'</dt>'. '<dd>'.$value.'</dd>'; } - + return $html.= '</dl>'; } diff --git a/library/ZendAfi/View/Helper/Telephone/Tags/NoticeDetaillee.php b/library/ZendAfi/View/Helper/Telephone/Tags/NoticeDetaillee.php index cff1ba99698370af5e66236798325febc22a3b1a..652e7c13607906aa36ce671a47cf5bdc62a37f34 100644 --- a/library/ZendAfi/View/Helper/Telephone/Tags/NoticeDetaillee.php +++ b/library/ZendAfi/View/Helper/Telephone/Tags/NoticeDetaillee.php @@ -16,7 +16,7 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -26,11 +26,11 @@ class ZendAfi_View_Helper_Telephone_Tags_NoticeDetaillee extends ZendAfi_View_He $this->view->_('Titre(s)') => $notice->getTitrePrincipal(), $this->view->_('Auteur(s)') => $notice->getAuteurPrincipal(), $this->view->_('Editeur(s)') => $notice->getEditeur(), - $this->view->_('Collation') => $notice->getCollation(), - $this->view->_('Collection(s)') => $notice->getCollection(), - $this->view->_('Année') => $notice->getAnnee(), - $this->view->_('Isbn') => $notice->getIsbn(), - $this->view->_('Ean') => $notice->getEan(), + $this->view->_('Collation') => $notice->getCollation(), + $this->view->_('Collection(s)') => $notice->getCollections(), + $this->view->_('Année') => $notice->getAnnee(), + $this->view->_('Isbn') => $notice->getIsbn(), + $this->view->_('Ean') => $notice->getEan(), $this->view->_('Langue(s)') => $notice->getLanguesList(), $this->view->_('Notes(s)') => $notice->getNotes() ); @@ -41,7 +41,7 @@ class ZendAfi_View_Helper_Telephone_Tags_NoticeDetaillee extends ZendAfi_View_He public function _fielsToHTMLTable($fields) { $rows = array(); - foreach ($fields as $label => $field) + foreach ($fields as $label => $field) $rows [] = sprintf('<tr><td>%s : </td><td>%s</td></tr>', $label, $this->_formatField($field)); @@ -53,13 +53,13 @@ class ZendAfi_View_Helper_Telephone_Tags_NoticeDetaillee extends ZendAfi_View_He if (!$field) return ''; if (!is_array($field)) return $field; - $html = '<ul>'; - foreach($field as $subfield) + $html = '<ul>'; + foreach($field as $subfield) $html .= '<li>'.$subfield.'</li>'; - $html .= '<ul>'; + $html .= '<ul>'; return $html; } - + } ?> \ No newline at end of file diff --git a/library/startup.php b/library/startup.php index d4eb260026edcd7f038529a48a2995287a8d24eb..2e663ae328a933c8140fc485fbf4b9c9b3d1e1f0 100644 --- a/library/startup.php +++ b/library/startup.php @@ -58,7 +58,7 @@ function defineConstant($name, $value) { function setupConstants() { defineConstant('BOKEH_MAJOR_VERSION','7.1'); - defineConstant('BOKEH_RELEASE_NUMBER', BOKEH_MAJOR_VERSION . '.2'); + defineConstant('BOKEH_RELEASE_NUMBER', BOKEH_MAJOR_VERSION . '.3'); defineConstant('ROOT_PATH', realpath(dirname(__FILE__).'/..').'/'); diff --git a/public/opac/css/global.css b/public/opac/css/global.css index 37f0c91f172bda4e10c50e42de7e0b535ee825d6..18e385023957b4aba9fdea59513219a21ff8390a 100644 --- a/public/opac/css/global.css +++ b/public/opac/css/global.css @@ -2461,17 +2461,13 @@ div.suggestion-achat-liste span { } div.suggestion-achat-liste div { - display: block; - min-height:180px; - border-top: 2px solid grey ; - margin: 5px; - padding:5px; + clear:both; } div.suggestion-achat-liste dl { padding:5px; - line-height:25px; - font-size:1.2em; + line-height:20px; + border-top: 2px solid grey; } div.suggestion-achat-liste dt { @@ -2479,7 +2475,7 @@ div.suggestion-achat-liste dt { clear:left; font-weight:bold; text-align:right; - width: 125px; + width: 200px; padding-right:0px; padding-left:30px; } diff --git a/tests/application/modules/admin/controllers/AccueilControllerConteneurDeuxColonnesTest.php b/tests/application/modules/admin/controllers/AccueilControllerConteneurDeuxColonnesTest.php new file mode 100644 index 0000000000000000000000000000000000000000..16cdc53ae4819a89aaefcce0149ebd9775bc2729 --- /dev/null +++ b/tests/application/modules/admin/controllers/AccueilControllerConteneurDeuxColonnesTest.php @@ -0,0 +1,316 @@ +<?php +/** + * Copyright (c) 2012-2014, Agence Française Informatique (AFI). All rights reserved. + * + * BOKEH is free software; you can redistribute it and/or modify + * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by + * the Free Software Foundation. + * + * There are special exceptions to the terms and conditions of the AGPL as it + * is applied to this software (see README file). + * + * BOKEH is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE + * along with BOKEH; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +abstract class AccueilControllerConteneurDeuxColonnesTestCase + extends Admin_AbstractControllerTestCase { + protected $_request_url = '/admin/accueil/conteneur2colonnes?id_profil=34&id_module=3&type_module=CONTENEUR_DEUX_COLONNES&config=accueil'; + + public function setUp() { + parent::setUp(); + + Class_AdminVar::newInstanceWithId('MENU_BOITE', ['valeur' => 1]); + + $this + ->fixture('Class_Profil', ['id' => 1, + 'libelle' => 'Main']) + ->addBoiteOfTypeInBanniere('NEWS') + ->save(); + + $this->profil_biologie = $this + ->fixture('Class_Profil', + ['id' => 34, + 'parent_id' => 1, + 'libelle' => 'Biologie']) + ->updateModuleConfigAccueil(3, + ['type_module' => 'CONTENEUR_DEUX_COLONNES', + 'division' => 2, + 'id_module' => 3, + 'preferences' => ['col_gauche_type' => 'NEWS', + 'col_droite_type' => 'CRITIQUES', + 'boite' => 'boite_de_la_division_du_milieu', + 'titre' => 'A la Une']]); + $this->profil_biologie->save(); + $this->profil_biologie->beCurrentProfil(); + } +} + + + +class AccueilControllerConteneurDeuxColonnesEmptyRenderTest extends AccueilControllerConteneurDeuxColonnesTestCase { + public function setUp() { + parent::setUp(); + $this->dispatch('/index/index/id_profil/34', true); + } + + /** @test */ + public function firsModuleShouldHaveId1000() { + $this->assertXPath('//div[@class="conteneur2colonnes"]//div[@id="boite_1000"]'); + } + + + /** @test */ + public function secondModuleShouldHaveId1001() { + $this->assertXPath('//div[@class="conteneur2colonnes"]//div[@id="boite_1001"]'); + } + + /** @test */ + public function secondModuleShouldBeCritics() { + $this->assertXPath('//div[@class="conteneur2colonnes"]//div[@class="boite critiques"]'); + } + + + /** @test */ + public function moduleNewsShouldHaveParentid3() { + $config = $this->profil_biologie->getModuleAccueilConfig(1000, 'NEWS'); + $this->assertEquals(3, $config['parent_id']); + } +} + + + + +class AccueilControllerConteneurDeuxColonnesUpdateNewsTest extends AccueilControllerConteneurDeuxColonnesTestCase { + public function setUp() { + parent::setUp(); + + $this + ->profil_biologie + ->updateModuleConfigAccueil(3, + ['type_module' => 'CONTENEUR_DEUX_COLONNES', + 'division' => 2, + 'id_module' => 3, + 'preferences' => ['col_gauche_type' => 'NEWS', + 'col_gauche_module_id' => 1000, + 'col_droite_type' => 'CRITIQUES', + 'boite' => 'boite_de_la_division_du_milieu', + 'titre' => 'A la Une']]) + ->updateModuleConfigAccueil(1000, + ['type_module' => 'NEWS', + 'id_module' => 1000, + 'parent_id' => 3, + 'preferences' => ['titre' => 'Les infos']]) + ->save(); + } + + + /** @test */ + public function renderedModuleNewsTitleShouldBeLesInfos() { + $this->dispatch('/index/index/id_profil/34', true); + $this->assertXPathContentContains('//div[@class="boite news"]//div', 'Les infos', + $this->_response->getBody()); + } + + /** @test */ + public function updatedModuleNewsTitleShouldBeDesNews() { + $this->postDispatch('/admin/accueil/news/config/accueil/id_profil/34/id_module/1000/type_module/NEWS', + ['id_items' => '34-12', + 'titre' => 'des news']); + $config = $this->profil_biologie->getModuleAccueilConfig(1000, 'NEWS'); + $this->assertEquals('des news', $config['preferences']['titre']); + } +} + + + + +class AccueilControllerConteneurDeuxColonnesDefaultTest extends AccueilControllerConteneurDeuxColonnesTestCase { + public function setUp() { + parent::setUp(); + $this->dispatch($this->_request_url, true); + } + + + /** @test */ + public function profilShouldBeValid() { + $this->assertTrue($this->profil_biologie->isValid()); + } + + + /** @test */ + public function shouldRenderConteneur2ColonnesView() { + $this->assertController('accueil'); + $this->assertAction('conteneur2colonnes'); + } + + + /** @test */ + public function inputTitleShouldDisplayALaUne() { + $this->assertXPath("//input[@name='titre'][@value='A la Une']"); + } + + + /** @test */ + public function selectColGaucheTypeShouldHaveNEWSSelected() { + $this->assertXPath("//select[@name='col_gauche_type']/option[@value='NEWS'][@selected='selected']"); + } + + + /** @test */ + public function selectColDroiteTypeShouldHaveCRITIQUESSelected() { + $this->assertXPath("//select[@name='col_droite_type']/option[@value='CRITIQUES'][@selected='selected']"); + } +} + + + +class AccueilControllerConteneurDeuxColonnesPostTest extends AccueilControllerConteneurDeuxColonnesTestCase { + public function setUp() { + parent::setUp(); + $this->postDispatch($this->_request_url, ['col_gauche_type' => 'KIOSQUE', + 'col_droite_type' => 'TAGS', + 'titre' => 'Ce mois ci']); + } + + + /** @test */ + public function moduleKiosqueShouldHaveBeenCreated() { + $this->assertEquals('KIOSQUE', $this->_getModuleTypeOf(1000, 'KIOSQUE')); + } + + + /** @test */ + public function moduleKiosqueParentIdShouldBe() { + $this->assertEquals(3, + $this->profil_biologie->getModuleAccueilConfig(1000, 'KIOSQUE')['parent_id']); + } + + + /** @test */ + public function moduleKiosqueShouldHaveBeenAddedToBox() { + $this->assertEquals(1000, + $this->_getModulePrefOf(3, 'col_gauche_module_id', 'CONTENEUR_DEUX_COLONNES')); + } + + + /** @test */ + public function moduleTagsShouldHaveBeenCreated() { + $this->assertEquals('TAGS', $this->_getModuleTypeOf(1001, 'TAGS')); + } + + + /** @test */ + public function moduleTagsShouldHaveBeenAddedToBox() { + $this->assertEquals(1001, + $this->_getModulePrefOf(3, 'col_droite_module_id', 'CONTENEUR_DEUX_COLONNES')); + } + + + /** @test */ + public function moduleTagShouldHaveParentId3() { + $config = $this->profil_biologie->getModuleAccueilConfig(1001, 'TAG'); + $this->assertEquals(3, $config['parent_id']); + } + + + protected function _getModuleTypeOf($id_module, $type) { + return $this->profil_biologie + ->getModuleAccueilConfig($id_module, $type)['type_module']; + } + + + protected function _getModulePrefOf($id_module, $pref, $type) { + return $this->profil_biologie + ->getModuleAccueilConfig($id_module, $type)['preferences'][$pref]; + } +} + + + +class AccueilControllerConteneurDeuxColonnesNewTest extends Admin_AbstractControllerTestCase { + public function setUp() { + parent::setUp(); + + $this->boite2cols = array('type_module' => 'CONTENEUR_DEUX_COLONNES', + 'division' => 2, + 'id_module' => 3); + + $this->profil_biologie = Class_Profil::getLoader() + ->newInstanceWithId(34) + ->setMenuHautOn(false) + ->setLibelle('Biologie') + ->updateModuleConfigAccueil(3, $this->boite2cols); + + Class_Profil::setCurrentProfil($this->profil_biologie); + $this->assertTrue($this->profil_biologie->isValid()); + } + + + /** @test */ + public function shouldRenderConteneur2ColonnesView() { + $this->request_url = '/admin/accueil/conteneur2colonnes?id_profil=34&id_module=3&type_module=CONTENEUR_DEUX_COLONNES&config=accueil'; + $this->dispatch($this->request_url); + + $this->assertController('accueil'); + $this->assertAction('conteneur2colonnes'); + } + + + /** @test */ + public function fonctionAdminOnClickShouldHaveActionConteneur2Colonnes() { + $this->dispatch('/opac?id_profil=34'); + $this->assertXPath("//img[contains(@onclick, 'conteneur2colonnes')]", $this->_response->getBody()); + } + + + /** @test */ + public function withModuleIdModulesShouldBeCreated() { + $this->boite2cols['preferences'] = ['col_gauche_module_id' => 234, + 'col_gauche_type' => 'COMPTEURS', + 'col_droite_module_id' => 235, + 'col_droite_type' => 'RECH_GUIDEE']; + + $this->profil_biologie->updateModuleConfigAccueil(3, $this->boite2cols); + $this->dispatch('/opac?id_profil=34'); + + $this->assertXPathContentContains('//div', 'Le catalogue contient'); + $this->assertXPathContentContains('//div', 'Recherche guidée', $this->_response->getBody()); + } +} + + + + +class AccueilControllerConteneurDeuxColonnesEditPostTest extends AccueilControllerConteneurDeuxColonnesTestCase { + public function setUp() { + parent::setUp(); + $this->postDispatch($this->_request_url, ['col_gauche_type' => 'NEWS', + 'col_droite_type' => 'CRITIQUES', + 'titre' => 'Ce mois ci']); + + $this->postDispatch($this->_request_url, ['col_gauche_type' => 'NEWS', + 'col_droite_type' => 'NEWS', + 'titre' => 'Ce mois ci']); + + } + + + /** @test */ + public function newsWidgetInLeftColShouldRemainTheSame() { + $this->assertEquals(1000, $this->profil_biologie->getCfgAccueilAsArray()['modules'][3]['preferences']['col_gauche_module_id']); + } + + + /** @test */ + public function newsWidgetInRightColShouldBeNew() { + $this->assertEquals(1002, $this->profil_biologie->getCfgAccueilAsArray()['modules'][3]['preferences']['col_droite_module_id']); + } + +} \ No newline at end of file diff --git a/tests/application/modules/admin/controllers/AccueilControllerFormationsTest.php b/tests/application/modules/admin/controllers/AccueilControllerFormationsTest.php index 5352c37be5542036ed1cf1503862ffb3c3ba3dd5..e95931f167eeafea35e53dca4f76117293eeb1ad 100644 --- a/tests/application/modules/admin/controllers/AccueilControllerFormationsTest.php +++ b/tests/application/modules/admin/controllers/AccueilControllerFormationsTest.php @@ -16,23 +16,18 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Admin_AccueilControllerFormationsTestWithDefaultSettings extends Admin_AbstractControllerTestCase { +class Admin_AccueilControllerFormationsTestWithDefaultSettings extends Admin_AbstractControllerTestCase { public function setUp() { parent::setUp(); - - $this->fixture('Class_Profil', + + $this->fixture('Class_Profil', ['id' => 1, - 'libelle' => 'Afibre']) - ->updateModuleConfigAccueil(1, ['type_module' => 'FORMATIONS_WIDGET', - 'division' => 1, - 'id_module' => 1, - 'preferences' => ['selected_formations' => '']]) - ->beCurrentProfil(); + 'libelle' => 'Afibre'])->beCurrentProfil(); $this->dispatch('admin/accueil/formations-widget?config=accueil&id_profil=1&id_module=1&type_module=FORMATIONS_WIDGET', true); } @@ -43,10 +38,10 @@ class Admin_AccueilControllerFormationsTestWithDefaultSettings extends Admin_Abs $this->assertXPathContentContains('//select/option', 'Boite par défaut de la division'); } - + /** @test */ public function treeselectFormationsBeDisplay() { - $this->assertXPath('//div[@class="treeselect"]', $this->_response->getBody()); + $this->assertXPath('//div[@class="treeselect"]'); } /** @test **/ @@ -58,12 +53,12 @@ class Admin_AccueilControllerFormationsTestWithDefaultSettings extends Admin_Abs -class Admin_AccueilControllerFormationsPostTest extends Admin_AbstractControllerTestCase { +class Admin_AccueilControllerFormationsPostTest extends Admin_AbstractControllerTestCase { public function setUp() { parent::setUp(); - - $this->fixture('Class_Profil', + + $this->fixture('Class_Profil', ['id' => 1, 'libelle' => 'Afibre']) ->updateModuleConfigAccueil(1, ['type_module' => 'FORMATIONS_WIDGET', @@ -71,15 +66,15 @@ class Admin_AccueilControllerFormationsPostTest extends Admin_AbstractController 'id_module' => 1]) ->beCurrentProfil(); - $this->postDispatch('admin/accueil/formations-widget?config=accueil&id_profil=1&id_module=1&type_module=FORMATIONS_WIDGET', + $this->postDispatch('admin/accueil/formations-widget?config=accueil&id_profil=1&id_module=1&type_module=FORMATIONS_WIDGET', ['selected_formations' => '1;2']); } - + /** @test */ public function formations1And2ShouldHaveBeenSaved() { $this->assertEquals( - '1;2', + '1;2', Class_Profil::getCurrentProfil() ->getModuleAccueilConfig(1, 'FORMATIONS_WIDGET')['preferences']['selected_formations']); } diff --git a/tests/application/modules/admin/controllers/AccueilControllerTest.php b/tests/application/modules/admin/controllers/AccueilControllerTest.php index 1999e1edbf47647daef8b276cf1ec74008813491..9619879583b39cc35acb62c15d4545f0569596b9 100644 --- a/tests/application/modules/admin/controllers/AccueilControllerTest.php +++ b/tests/application/modules/admin/controllers/AccueilControllerTest.php @@ -21,276 +21,6 @@ require_once 'AdminAbstractControllerTestCase.php'; -abstract class AccueilControllerBoite2ColTestCase - extends Admin_AbstractControllerTestCase { - protected $_request_url = '/admin/accueil/conteneur2colonnes?id_profil=34&id_module=3&type_module=CONTENEUR_DEUX_COLONNES&config=accueil'; - - public function setUp() { - parent::setUp(); - - Class_AdminVar::newInstanceWithId('MENU_BOITE', ['valeur' => 1]); - - $this - ->fixture('Class_Profil', ['id' => 1, - 'libelle' => 'Main']) - ->addBoiteOfTypeInBanniere('NEWS') - ->save(); - - $this->profil_biologie = $this - ->fixture('Class_Profil', - ['id' => 34, - 'parent_id' => 1, - 'libelle' => 'Biologie']) - ->updateModuleConfigAccueil(3, - ['type_module' => 'CONTENEUR_DEUX_COLONNES', - 'division' => 2, - 'id_module' => 3, - 'preferences' => ['col_gauche_type' => 'NEWS', - 'col_droite_type' => 'CRITIQUES', - 'boite' => 'boite_de_la_division_du_milieu', - 'titre' => 'A la Une']]); - $this->profil_biologie->save(); - $this->profil_biologie->beCurrentProfil(); - } -} - - - -class AccueilControllerEmptyBoite2ColRenderTest extends AccueilControllerBoite2ColTestCase { - public function setUp() { - parent::setUp(); - $this->dispatch('/index/index/id_profil/34', true); - } - - /** @test */ - public function firsModuleShouldHaveId1000() { - $this->assertXPath('//div[@class="conteneur2colonnes"]//div[@id="boite_1000"]'); - } - - - /** @test */ - public function secondModuleShouldHaveId1001() { - $this->assertXPath('//div[@class="conteneur2colonnes"]//div[@id="boite_1001"]'); - } - - /** @test */ - public function secondModuleShouldBeCritics() { - $this->assertXPath('//div[@class="conteneur2colonnes"]//div[@class="boite critiques"]'); - } - - - /** @test */ - public function moduleNewsShouldHaveParentid3() { - $config = $this->profil_biologie->getModuleAccueilConfig(1000, 'NEWS'); - $this->assertEquals(3, $config['parent_id']); - } -} - - - - -class AccueilControllerBoite2ColUpdateNewsTest extends AccueilControllerBoite2ColTestCase { - public function setUp() { - parent::setUp(); - - $this - ->profil_biologie - ->updateModuleConfigAccueil(3, - ['type_module' => 'CONTENEUR_DEUX_COLONNES', - 'division' => 2, - 'id_module' => 3, - 'preferences' => ['col_gauche_type' => 'NEWS', - 'col_gauche_module_id' => 1000, - 'col_droite_type' => 'CRITIQUES', - 'boite' => 'boite_de_la_division_du_milieu', - 'titre' => 'A la Une']]) - ->updateModuleConfigAccueil(1000, - ['type_module' => 'NEWS', - 'id_module' => 1000, - 'parent_id' => 3, - 'preferences' => ['titre' => 'Les infos']]) - ->save(); - } - - - /** @test */ - public function renderedModuleNewsTitleShouldBeLesInfos() { - $this->dispatch('/index/index/id_profil/34', true); - $this->assertXPathContentContains('//div[@class="boite news"]//div', 'Les infos', - $this->_response->getBody()); - } - - /** @test */ - public function updatedModuleNewsTitleShouldBeDesNews() { - $this->postDispatch('/admin/accueil/news/config/accueil/id_profil/34/id_module/1000/type_module/NEWS', - ['id_items' => '34-12', - 'titre' => 'des news']); - $config = $this->profil_biologie->getModuleAccueilConfig(1000, 'NEWS'); - $this->assertEquals('des news', $config['preferences']['titre']); - } -} - - - - -class AccueilControllerBoite2ColTest extends AccueilControllerBoite2ColTestCase { - public function setUp() { - parent::setUp(); - $this->dispatch($this->_request_url, true); - } - - - /** @test */ - public function profilShouldBeValid() { - $this->assertTrue($this->profil_biologie->isValid()); - } - - - /** @test */ - public function shouldRenderConteneur2ColonnesView() { - $this->assertController('accueil'); - $this->assertAction('conteneur2colonnes'); - } - - - /** @test */ - public function inputTitleShouldDisplayALaUne() { - $this->assertXPath("//input[@name='titre'][@value='A la Une']"); - } - - - /** @test */ - public function selectColGaucheTypeShouldHaveNEWSSelected() { - $this->assertXPath("//select[@name='col_gauche_type']/option[@value='NEWS'][@selected='selected']"); - } - - - /** @test */ - public function selectColDroiteTypeShouldHaveCRITIQUESSelected() { - $this->assertXPath("//select[@name='col_droite_type']/option[@value='CRITIQUES'][@selected='selected']"); - } -} - - - - -class AccueilControllerBoite2ColPostTest extends AccueilControllerBoite2ColTestCase { - public function setUp() { - parent::setUp(); - $this->postDispatch($this->_request_url, ['col_gauche_type' => 'KIOSQUE', - 'col_droite_type' => 'TAGS', - 'titre' => 'Ce mois ci']); - } - - - /** @test */ - public function moduleKiosqueShouldHaveBeenCreated() { - $this->assertEquals('KIOSQUE', $this->_getModuleTypeOf(1000, 'KIOSQUE')); - } - - - /** @test */ - public function moduleKiosqueParentIdShouldBe() { - $this->assertEquals(3, - $this->profil_biologie->getModuleAccueilConfig(1000, 'KIOSQUE')['parent_id']); - } - - - /** @test */ - public function moduleKiosqueShouldHaveBeenAddedToBox() { - $this->assertEquals(1000, - $this->_getModulePrefOf(3, 'col_gauche_module_id', 'CONTENEUR_DEUX_COLONNES')); - } - - - /** @test */ - public function moduleTagsShouldHaveBeenCreated() { - $this->assertEquals('TAGS', $this->_getModuleTypeOf(1001, 'TAGS')); - } - - - /** @test */ - public function moduleTagsShouldHaveBeenAddedToBox() { - $this->assertEquals(1001, - $this->_getModulePrefOf(3, 'col_droite_module_id', 'CONTENEUR_DEUX_COLONNES')); - } - - - /** @test */ - public function moduleTagShouldHaveParentId3() { - $config = $this->profil_biologie->getModuleAccueilConfig(1001, 'TAG'); - $this->assertEquals(3, $config['parent_id']); - } - - - protected function _getModuleTypeOf($id_module, $type) { - return $this->profil_biologie - ->getModuleAccueilConfig($id_module, $type)['type_module']; - } - - - protected function _getModulePrefOf($id_module, $pref, $type) { - return $this->profil_biologie - ->getModuleAccueilConfig($id_module, $type)['preferences'][$pref]; - } -} - - - -class AccueilControllerNewBoite2ColTest extends Admin_AbstractControllerTestCase { - public function setUp() { - parent::setUp(); - - $this->boite2cols = array('type_module' => 'CONTENEUR_DEUX_COLONNES', - 'division' => 2, - 'id_module' => 3); - - $this->profil_biologie = Class_Profil::getLoader() - ->newInstanceWithId(34) - ->setMenuHautOn(false) - ->setLibelle('Biologie') - ->updateModuleConfigAccueil(3, $this->boite2cols); - - Class_Profil::setCurrentProfil($this->profil_biologie); - $this->assertTrue($this->profil_biologie->isValid()); - } - - - /** @test */ - public function shouldRenderConteneur2ColonnesView() { - $this->request_url = '/admin/accueil/conteneur2colonnes?id_profil=34&id_module=3&type_module=CONTENEUR_DEUX_COLONNES&config=accueil'; - $this->dispatch($this->request_url); - - $this->assertController('accueil'); - $this->assertAction('conteneur2colonnes'); - } - - - /** @test */ - public function fonctionAdminOnClickShouldHaveActionConteneur2Colonnes() { - $this->dispatch('/opac?id_profil=34'); - $this->assertXPath("//img[contains(@onclick, 'conteneur2colonnes')]", $this->_response->getBody()); - } - - - /** @test */ - public function withModuleIdModulesShouldBeCreated() { - $this->boite2cols['preferences'] = array('col_gauche_module_id' => 234, - 'col_gauche_type' => 'COMPTEURS', - 'col_droite_module_id' => 235, - 'col_droite_type' => 'RECH_GUIDEE'); - - $this->profil_biologie->updateModuleConfigAccueil(3, $this->boite2cols); - $this->dispatch('/opac?id_profil=34'); - - $this->assertXPathContentContains('//div', 'Le catalogue contient'); - $this->assertXPathContentContains('//div', 'Recherche guidée'); - } -} - - - - class AccueilControllerLangueConfigurationTest extends Admin_AbstractControllerTestCase { public function setUp() { parent::setUp(); @@ -505,15 +235,29 @@ class AccueilControllerConfigSitothequeDefaultsTest extends Admin_AbstractContro $this->assertXPath("//input[@name='nb_aff'][@value='2']"); } + /** @test */ public function checkboxGroupByCategorieShouldNotBeChecked() { $this->assertXPath('//input[@type="checkbox"][@name="group_by_categorie"][not(@checked)]'); } + /** @test */ public function inputHiddenIdItemsShouldContainsSelectedItems() { $this->assertXPath('//input[@type="hidden"][@name="id_items"][@value="12-13"]'); } + + + /** @test */ + public function displayOrderRandomShouldBeChecked() { + $this->assertXPath('//input[@type="radio"][@name="display_order"][@value="Random"]'); + } + + /** @test */ + public function displayOrderSelectionShouldBePresent() { + $this->assertXPath('//input[@type="radio"][@name="display_order"][@value="Selection"]'); + } + } @@ -525,11 +269,12 @@ class AccueilControllerConfigSitothequeWithPreferencesTest extends Admin_Abstrac Class_Profil::getCurrentProfil() ->updateModuleConfigAccueil(25, - array('type_module' => 'SITO', - 'division' => 1, - 'id_module' => 25, - 'preferences' => array('titre' => 'Ma Sito', - 'group_by_categorie' => true))); + ['type_module' => 'SITO', + 'division' => 1, + 'id_module' => 25, + 'preferences' => ['titre' => 'Ma Sito', + 'group_by_categorie' => true, + 'display_order' => 'Selection']]); $this->dispatch('/admin/accueil/sitotheque?config=accueil&type_module=SITO&id_module=25'); } @@ -545,6 +290,12 @@ class AccueilControllerConfigSitothequeWithPreferencesTest extends Admin_Abstrac public function checkboxGroupByCategorieShouldNotBeChecked() { $this->assertXPath('//input[@type="checkbox"][@name="group_by_categorie"][@checked="checked"]'); } + + + /** @test */ + public function displayOrderSelectionShouldBeChecked() { + $this->assertXPath('//input[@type="radio"][@name="display_order"][@checked="checked"][@value="Selection"]'); + } } diff --git a/tests/application/modules/admin/controllers/AlbumControllerTest.php b/tests/application/modules/admin/controllers/AlbumControllerTest.php index c5b2b0cde139d84fe1cdb2817dc95c75babb184e..6effc84d6b34c099af86ae0ea2f6a7c14d4d0398 100644 --- a/tests/application/modules/admin/controllers/AlbumControllerTest.php +++ b/tests/application/modules/admin/controllers/AlbumControllerTest.php @@ -989,7 +989,7 @@ class Admin_AlbumControllerPostAlbumRenaissanceToPatrimoineTest /** @test */ public function shouldHaveCollectionRatmInCollection() { - $this->assertContains('Ratm', $this->new_notice->getCollection()); + $this->assertContains('Ratm', $this->new_notice->getCollections()); } diff --git a/tests/application/modules/admin/controllers/ProfilControllerTest.php b/tests/application/modules/admin/controllers/ProfilControllerTest.php index 2eb7d917e69c62d30d418bd7d5eda00f8db87c12..2a84ff649fe5ff6673ece84f1ded140ef7c86000 100644 --- a/tests/application/modules/admin/controllers/ProfilControllerTest.php +++ b/tests/application/modules/admin/controllers/ProfilControllerTest.php @@ -51,25 +51,23 @@ abstract class Admin_ProfilControllerProfilJeunesseTestCase extends Admin_Abstra 'resa' => 2]]; - $this->profil_jeunesse = Class_Profil::getLoader() - ->newInstanceWithId(5) - ->setBrowser('opac') - ->setTitreSite('Médiathèque de Melun') - ->setLibelle('Profil Jeunesse') - ->setCommentaire('Pour les jeunes') - ->setSkin('modele') - ->setCfgSite(ZendAfi_Filters_Serialize::serialize($cfg_site)) - ->setCfgNotice($cfg_notice) - ->setMailSite('tintin@herge.be') - ->setMailSuggestionAchat('suggestion@herge.be') - ->setHauteurBanniere(150) - ->setBoiteLoginInBanniere(true) - ->setRewriteUrl('jeunesse'); - - - $this->profil_wrapper = Storm_Test_ObjectWrapper - ::onLoaderOfModel('Class_Profil') - ->whenCalled('save')->answers(true)->getWrapper(); + $this->profil_jeunesse = $this->fixture('Class_Profil', + ['id' => 5, + 'browser' => 'opac', + 'titre_site' => 'Médiathèque de Melun', + 'libelle' => 'Profil Jeunesse', + 'commentaire' => 'Pour les jeunes', + 'skin' => 'modele', + 'cfg_site' => $cfg_site, + 'cfg_notice' => $cfg_notice, + 'mail_site' => 'tintin@herge.be', + 'mail_suggestion_achat' => 'suggestion@herge.be', + 'hauteur_banniere' => 150, + 'boite_login_in_banniere' => true, + 'rewrite_url' => 'jeunesse']); + + + $this->profil_wrapper = Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Profil'); ZendAfi_Auth::getInstance()->getIdentity()->ROLE_LEVEL = 7; @@ -1272,25 +1270,35 @@ class Admin_ProfilControllerCopyProfilJeunesseTest extends Admin_ProfilControlle class Admin_ProfilControllerDeepCopyProfilJeunesseTest extends Admin_ProfilControllerProfilJeunesseWithPagesTestCase { - public function setUp() { - parent::setUp(); - - $id = 500; - Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Profil') - ->whenCalled('findAllBy') - ->answers([]) - ->whenCalled('save') - ->willDo(function ($model) use (&$id) { - $model->setId($id++); - } ); - + /** @test */ + public function withoutErrorShouldRedirectToEditProfilWithNewId() { + $max_id = Class_Profil::findFirstBy(['order' => 'id desc'])->getId(); $this->dispatch('/admin/profil/deep_copy/id_profil/5', true); + + $this->assertRedirectTo('/admin/profil/edit/id_profil/'.($max_id+1), + $this->getResponseLocation()); } /** @test */ - public function assertRedirectToEditProfilId100() { - $this->assertRedirect('admin/profil/edit/id_profil/500'); + public function withErrorShouldRedirectToIndexAndNotify() { + $profil_mock = Storm_Test_ObjectWrapper::mock(); + $profil_mock + ->whenCalled('getId') + ->answers(7) + + ->whenCalled('deepCopy') + ->answers( + Storm_Test_ObjectWrapper::mock() + ->whenCalled('save')->answers(false) + ->whenCalled('getErrors')->answers(['something unexpected happened'])); + + + Class_Profil::getLoader()->cacheInstance($profil_mock); + + $this->dispatch('/admin/profil/deep_copy/id_profil/7', true); + $this->assertRedirectTo('/admin/profil', $this->getResponseLocation()); + $this->assertFlashMessengerContentContains('Duplication impossible: something unexpected happened'); } } diff --git a/tests/application/modules/opac/controllers/BibControllerIndexActionTest.php b/tests/application/modules/opac/controllers/BibControllerIndexActionTest.php index ca44692c979462b36308c08d3d4adebd66a87a79..d969d03100c58cc39c10e1890daff455bffc0d12 100644 --- a/tests/application/modules/opac/controllers/BibControllerIndexActionTest.php +++ b/tests/application/modules/opac/controllers/BibControllerIndexActionTest.php @@ -16,7 +16,7 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ require_once 'AbstractControllerTestCase.php'; @@ -55,7 +55,7 @@ class BibControllerIndexActionTest extends AbstractControllerTestCase { ->newInstanceWithId(2) ->setIdSite(0) ->setTitre('Ecrivez des tests !'); - + Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Article') ->whenCalled('getArticlesByPreferences') ->with(array('id_bib' => 3)) @@ -94,14 +94,14 @@ class BibControllerIndexActionTest extends AbstractControllerTestCase { /** @test */ function setTooltipJSShouldBeGenerated() { $this->assertTrue(false !== strpos($this->_response->getBody(), - "setTooltip($('.tooltip_bib3'), '<a href=\"" . BASE_URL . "/bib/bibview/id/3\"><b>BibZone3</b></a><br />'"), + "setTooltip($('.tooltip_bib3'), '<a href=\"/bib/bibview/id/3\"><b>BibZone3</b></a><br />'"), $this->_response->getBody()); } /** @test */ function articleEcrivezDesTestShouldBeVisible() { - $this->assertXPathContentContains("//li//a", "Ecrivez des tests !", $this->_response->getBody()); + $this->assertXPathContentContains("//li//a", "Ecrivez des tests !", $this->_response->getBody()); } } diff --git a/tests/application/modules/opac/controllers/BibControllerTest.php b/tests/application/modules/opac/controllers/BibControllerTest.php index 3c37849df3c2462234517ec56330a82e4ec06598..cc9814c65bca68b5ec3a51095b11ec9b98927e7d 100644 --- a/tests/application/modules/opac/controllers/BibControllerTest.php +++ b/tests/application/modules/opac/controllers/BibControllerTest.php @@ -201,11 +201,15 @@ class BibControllerMapViewTest extends BibControllerWithZoneTestCase { public function setUp() { parent::setUp(); - $aff_zone = array('profilID' => '3', - 'libelle' => 'Annecy', - 'posX' => 2, - 'posY' => 5, - 'posPoint' => 'droite'); + $this->fixture('Class_Profil', + ['id' => 3, + 'libelle' => 'Annecy']); + + $aff_zone = ['profilID' => '3', + 'libelle' => 'Annecy', + 'posX' => 2, + 'posY' => 5, + 'posPoint' => 'droite']; $this->bib_annecy->setAffZone(ZendAfi_Filters_Serialize::serialize($aff_zone)); $this->dispatch('bib/mapzoneview/id/1'); @@ -232,7 +236,7 @@ class BibControllerMapViewTest extends BibControllerWithZoneTestCase { /** @test */ public function bibAnnecyShouldBeVisibleOnMap() { - $this->assertXPathContentContains("//span[contains(@onclick, '?id_profil')]", "Annecy"); + $this->assertXPathContentContains("//span[contains(@onclick, '/id_profil/3')]", "Annecy"); } } diff --git a/tests/application/modules/opac/controllers/CmsControllerTest.php b/tests/application/modules/opac/controllers/CmsControllerTest.php index 226338958b1aa38a0b151e6b7d4856e880a5b2a6..1604a601aeb63ee5c83e21cd8cca61ac7f717919 100644 --- a/tests/application/modules/opac/controllers/CmsControllerTest.php +++ b/tests/application/modules/opac/controllers/CmsControllerTest.php @@ -788,6 +788,25 @@ abstract class CmsControllerWithFeteDeLaFriteTestCase extends AbstractController } } +class CmsControllerViewNoticeMetasTest extends CmsControllerWithFeteDeLaFriteTestCase { + public function setUp() { + parent::setUp(); + $this->dispatch('/cms/articleview/id/224', true); + } + + + /** @test */ + public function pageShouldContainTitleMeta() { + $this->assertXPathContentContains('//meta[@property="og:title"]/@content', 'La fête de la frite', $this->_response->getBody()); + } + + /** @test */ + public function pageShouldContainDescriptionMeta() { + $this->assertXPath('//meta[@property="og:description"]/@content'); + } + +} + class CmsControllerArticleViewInEnglishTest extends CmsControllerWithFeteDeLaFriteTestCase { diff --git a/tests/application/modules/opac/controllers/IndexControllerTest.php b/tests/application/modules/opac/controllers/IndexControllerTest.php index 9f90a1fe56347097a9f35b7348128dd94f59196e..5140400d2bd567cf9844c65fd38b38cd3aba1808 100644 --- a/tests/application/modules/opac/controllers/IndexControllerTest.php +++ b/tests/application/modules/opac/controllers/IndexControllerTest.php @@ -232,4 +232,44 @@ class IndexControllerSitemapTest extends AbstractControllerTestCase { } -?> \ No newline at end of file + + +class IndexControllerRewriteUrlTest extends AbstractControllerTestCase { + public function setUp() { + parent::setUp(); + + ZendAfi_Auth::getInstance()->logUser($this->fixture('Class_Users', + ['id' => 1, + 'login' => 'guest', + 'password' => 'guest', + 'role_level' => ZendAfi_Acl_AdminControllerRoles::INVITE])); + $this->fixture('Class_Profil', ['id' => 345, + 'libelle' => 'Zork - Main', + 'parent_id' => null, + 'rewrite_url' => 'zork', + 'access_level' => ZendAfi_Acl_AdminControllerRoles::ABONNE_SIGB]); + + $this->fixture('Class_Profil', ['id' => 879, + 'libelle' => 'Zork - Child', + 'parent_id' => 345, + 'rewrite_url' => 'zork-child']); + } + + + /** @test */ + public function privateProfilShouldRedirectToLogin() { + $this->dispatch('/zork', true); + $this->assertModule('opac'); + $this->assertController('auth'); + $this->assertAction('login'); + } + + + /** @test */ + public function publicProfilWithPrivateParentProfilShouldRedirectToLogin() { + $this->dispatch('/zork-child', true); + $this->assertModule('opac'); + $this->assertController('auth'); + $this->assertAction('login'); + } +} \ No newline at end of file diff --git a/tests/library/Class/BibTest.php b/tests/library/Class/BibTest.php index 4f6f83e0d8826d117f9b042ffea43b86cd81bc23..ab26a1f39ab3a611f41dc7ac077c3c363aca500b 100644 --- a/tests/library/Class/BibTest.php +++ b/tests/library/Class/BibTest.php @@ -16,26 +16,26 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ class BibTest extends Storm_Test_ModelTestCase { /** @test */ function loaderFindAllWithPortailShouldIncludePortail() { - $this->assertEquals(0, + $this->assertEquals(0, array_first(Class_Bib::getLoader()->findAllWithPortail())->getId()); } /** @test */ function loaderFindAllByWithPortailShouldIncludePortail() { - $this->assertEquals(0, + $this->assertEquals(0, array_first(Class_Bib::getLoader()->findAllByWithPortail(array()))->getId()); } - /** + /** * Non régression bug n'affiche aucune bib sur sélection territoire "toutes" admin bib - * @test + * @test */ public function findAllByIdZoneShouldForceIntForRequest() { Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Bib') @@ -44,7 +44,7 @@ class BibTest extends Storm_Test_ModelTestCase { ->answers('ALL') ->whenCalled('findAllBy') - ->with(['id_zone' => 3, + ->with(['id_zone' => 3, 'order' => 'ville']) ->answers('ZONE'); @@ -52,6 +52,31 @@ class BibTest extends Storm_Test_ModelTestCase { $this->assertEquals('ZONE', Class_Bib::findAllByIdZone(3)); } + + + /** @test */ + public function withAffZoneContainingIdProfilGetUrlShouldAnswerProfilRewriteUrl() { + $this->fixture('Class_Profil', + ['id' => 23, + 'libelle' => 'Annecy', + 'rewrite_url' => 'annecy']); + + $bib = $this->fixture('Class_Bib', + ['id' => 2, + 'aff_zone' => serialize(['profilID' => 23, + 'libelle' => 'Annecy'])]); + + $this->assertContains('/annecy', $bib->getUrl()); + } + + + /** @test */ + public function withEmptyAffZoneContainingIdProfilGetUrlShouldAnswerBibViewId23() { + $bib = $this->fixture('Class_Bib', + ['id' => 2]); + + $this->assertContains('/bib/bibview/id/2', $bib->getUrl()); + } } ?> \ No newline at end of file diff --git a/tests/library/Class/ProfilTest.php b/tests/library/Class/ProfilTest.php index bbcd9b6c72e3dba6557fb4fbdbf39f18403c465a..16465d7d7d0a1ba4896ed3348340633b90b3c779 100644 --- a/tests/library/Class/ProfilTest.php +++ b/tests/library/Class/ProfilTest.php @@ -1277,10 +1277,12 @@ class ProfilWithPagesCopyTest extends Storm_Test_ModelTestCase { $profil = $this->fixture('Class_Profil', ['id' => 1, - 'nb_divisions' => 2]) + 'nb_divisions' => 2, + 'rewrite_url' => 'adulte']) ->setSubProfils([ $this->fixture('Class_Profil', ['id' => 2]), $this->fixture('Class_Profil', ['id' => 3]), $this->fixture('Class_Profil', ['id' => 4, + 'rewrite_url' => 'CD', 'libelle' => 'CD']), $this->fixture('Class_Profil', ['id' => 5]) @@ -1299,6 +1301,11 @@ class ProfilWithPagesCopyTest extends Storm_Test_ModelTestCase { $this->assertEquals(4, $this->_clone->numberOfSubProfils()); } + /** @test */ + public function cloneRewriteUrlShouldBeEmpty() { + $this->assertEmpty($this->_clone->getRewriteUrl()); + } + /** @test */ public function cloneFirstPageLibelleShouldBeIndexedAtNouveauProfil() { @@ -1320,6 +1327,12 @@ class ProfilWithPagesCopyTest extends Storm_Test_ModelTestCase { } + /** @test */ + public function clonedPageCDRewriteUrlShouldBeEmpty() { + $this->assertEmpty($this->_clone->getSubProfils()['CD']->getRewriteUrl()); + } + + /** @test */ public function pageCdParentShouldBeClonedProfil() { $this->assertSame($this->_clone, $this->_clone->getSubProfils()['CD']->getParentProfil()); diff --git a/tests/library/ZendAfi/View/Helper/Accueil/SitoTest.php b/tests/library/ZendAfi/View/Helper/Accueil/SitoTest.php index 7fefa7a1e74de1fa2081a3b415687df3cafb2df8..8026bc4b4cb3ae112966e7c362c9b4b87ee0b204 100644 --- a/tests/library/ZendAfi/View/Helper/Accueil/SitoTest.php +++ b/tests/library/ZendAfi/View/Helper/Accueil/SitoTest.php @@ -16,7 +16,7 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ require_once 'library/ZendAfi/View/Helper/ViewHelperTestCase.php'; @@ -49,15 +49,62 @@ abstract class SitoViewHelperTestCase extends ViewHelperTestCase { 'description' => 'du vin du vin!', 'url' => 'http://www.rmll.info', 'categorie' => $france]); - + $site_rmll->save(); - $helper = new ZendAfi_View_Helper_Accueil_Sito(2, array('division' => '1', - 'type_module' => 'SITO', - 'preferences' => $this->_preferences)); - $helper->setView(new ZendAfi_Controller_Action_Helper_View()); - $this->html = $helper->getBoite(); + $this->_helper = new ZendAfi_View_Helper_Accueil_Sito(2, ['division' => '1', + 'type_module' => 'SITO', + 'preferences' => $this->_preferences]); + $this->_helper->setView(new ZendAfi_Controller_Action_Helper_View()); + $this->html = $this->_helper->getBoite(); + } +} + + + +class SitoViewHelperSelectItemsBySelectionOrderTest extends SitoViewHelperTestCase { + protected $_preferences = ['titre' => 'Ma sito', + 'type_aff' => 1, + 'id_items' => '12-15', + 'id_categorie' => '', + 'nb_aff' => 0, + 'display_order' => 'Selection']; + + /** @test */ + public function firstSiteShouldBeFOSDEM() { + $this->assertXPathContentContains($this->html, + '//div/div[1]//h2//a', + 'FOSDEM'); + } + + + /** @test */ + public function secondSiteShouldBeRMLL() { + $this->assertXPathContentContains($this->html, + '//div/div[2]//h2//a', + 'FOSDEM'); + } +} + + + + +class SitoViewHelperSelectItemsByRandomOrderTest extends SitoViewHelperTestCase { + protected $_preferences = ['titre' => 'Ma sito', + 'type_aff' => 1, + 'id_items' => '12-15', + 'id_categorie' => '', + 'nb_aff' => 2, + 'display_order' => 'Random']; + /** @test */ + public function itemsShouldBeShuffled() { + $htmls = []; + for($i=0; $i<10; $i++) { + $htmls []= $this->_helper->getBoite(); + } + + $this->assertEquals(2, count(array_unique($htmls))); } } @@ -65,32 +112,33 @@ abstract class SitoViewHelperTestCase extends ViewHelperTestCase { class SitoViewHelperSelectItemsAndCatsTest extends SitoViewHelperTestCase { - protected $_preferences = array('titre' => 'Ma sito', - 'type_aff' => 1, - 'id_items' => 12, - 'id_categorie' => 3, - 'nb_aff' => 2); + protected $_preferences = ['titre' => 'Ma sito', + 'type_aff' => 1, + 'id_items' => 12, + 'id_categorie' => 3, + 'nb_aff' => 2, + 'display_order' => 'Random']; /** @test */ public function titleShouldBeMaSito() { - $this->assertXPathContentContains($this->html, - '//div[@class="titre"]//h1', + $this->assertXPathContentContains($this->html, + '//div[@class="titre"]//h1', 'Ma sito'); } - + /** @test */ public function h2ShouldContainsFosdemDotOrg() { - $this->assertXPathContentContains($this->html, - '//h2//a[contains(@href, "fosdem.org")]', + $this->assertXPathContentContains($this->html, + '//h2//a[contains(@href, "fosdem.org")]', 'FOSDEM'); } /** @test */ public function divSitothequeShouldContainsPleinDeBieres() { - $this->assertXPathContentContains($this->html, - '//div[@class="sitotheque"]', + $this->assertXPathContentContains($this->html, + '//div[@class="sitotheque"]', utf8_encode('plein de bières belges')); } } @@ -105,18 +153,29 @@ class SitoViewHelperLastTest extends SitoViewHelperTestCase { /** @test */ public function titleShouldBeDerniersSites() { - $this->assertXPathContentContains($this->html, - '//div[@class="titre"]//h1', + $this->assertXPathContentContains($this->html, + '//div[@class="titre"]//h1', 'Derniers sites'); } - + /** @test */ public function h2ShouldContainsRmllDotInfo() { - $this->assertXPathContentContains($this->html, - '//h2//a[contains(@href, "rmll.info")]', + $this->assertXPathContentContains($this->html, + '//h2//a[contains(@href, "rmll.info")]', 'RMLL'); } + + /** @test */ + public function itemsShouldBeShuffled() { + $htmls = []; + for($i=0; $i<10; $i++) { + $htmls []= $this->_helper->getBoite(); + } + + $this->assertEquals(2, count(array_unique($htmls))); + } + } @@ -131,7 +190,7 @@ class SitoViewHelperGroupByCategorieTest extends SitoViewHelperTestCase { /** @test */ public function liEnBelgiqueShouldContainsFosdem() { - $this->assertXPathContentContains($this->html, + $this->assertXPathContentContains($this->html, '//ul/li/h2/a[text()="Belgique"]/../../ul/li', 'FOSDEM'); } @@ -139,7 +198,7 @@ class SitoViewHelperGroupByCategorieTest extends SitoViewHelperTestCase { /** @test */ public function liEnFranceShouldContainsRMLL() { - $this->assertXPathContentContains($this->html, + $this->assertXPathContentContains($this->html, '//ul/li/h2/a[text()="France"]/../../ul/li', 'RMLL'); } @@ -147,7 +206,7 @@ class SitoViewHelperGroupByCategorieTest extends SitoViewHelperTestCase { /** @test */ public function scriptLoaderShouldContainsCodeToAnimateSitotheque() { - $this->assertContains('ul.sitotheque>li>h2>a', + $this->assertContains('ul.sitotheque>li>h2>a', Class_ScriptLoader::getInstance()->html()); } }