From a612ef9c3de83c13c6074389d8369e90d6037d6b Mon Sep 17 00:00:00 2001 From: efalcy <efalcy@git-test.afi-sa.fr> Date: Thu, 8 Aug 2013 17:10:46 +0000 Subject: [PATCH] #7067 & #7787 : Correction des tests --- .../modules/admin/controllers/IndexController.php | 1 - .../telephone/views/scripts/recherche/viewnotice.phtml | 6 +++++- library/Class/Codification.php | 2 +- library/Class/Onglet.php | 4 ++-- library/ZendAfi/View/Helper/Notice/Abstract.php | 10 ++++++---- library/ZendAfi/View/Helper/Notice/Entete.php | 6 +++--- .../admin/controllers/AdminIndexControllerTest.php | 2 +- .../opac/controllers/RechercheControllerTest.php | 2 +- .../controllers/RechercheControllerHarryPotterTest.php | 2 +- tests/library/Class/AdminVarTest.php | 5 ++--- 10 files changed, 22 insertions(+), 18 deletions(-) diff --git a/application/modules/admin/controllers/IndexController.php b/application/modules/admin/controllers/IndexController.php index a93b4e4cc04..9e3b36f995a 100644 --- a/application/modules/admin/controllers/IndexController.php +++ b/application/modules/admin/controllers/IndexController.php @@ -62,7 +62,6 @@ class Admin_IndexController extends Zend_Controller_Action { } } - Class_AdminVar::setDefaultValuesForWorkflowMessage(); $this->view->titre = 'Gestion des variables'; $this->view->vars = $existing_variables; diff --git a/application/modules/telephone/views/scripts/recherche/viewnotice.phtml b/application/modules/telephone/views/scripts/recherche/viewnotice.phtml index a07f6b8178b..908d7f0eab9 100644 --- a/application/modules/telephone/views/scripts/recherche/viewnotice.phtml +++ b/application/modules/telephone/views/scripts/recherche/viewnotice.phtml @@ -10,7 +10,11 @@ echo $this->toolbar($this->_("Recherche"), <p><?php if ($annee = $this->notice->getAnnee()) echo $this->_('Année')," : ", $annee;?></p> <p><?php if ($editeur = $this->notice->getEditeur()) - echo $this->_('Editeur(s)')," : ", $editeur;?></p> + echo $this->_('Editeur(s)')," : ", $editeur; + $entete = new ZendAfi_View_Helper_Notice_Entete(); + +echo $entete->addSeries($this->notice,$this); +?></p> </li> <?php foreach ($this->actions as $libelle => $action) { ?> <li><?php echo $this->tagAnchor(array('action' => $action['action']), diff --git a/library/Class/Codification.php b/library/Class/Codification.php index ce2391e5ba9..86a092f5b53 100644 --- a/library/Class/Codification.php +++ b/library/Class/Codification.php @@ -210,7 +210,7 @@ class Class_Codification { "tags" => Class_Onglet::forLibelleAndType($translate->_("Rebondir dans le catalogue"),'tags'), "biographie" => Class_Onglet::forLibelleAndType($translate->_("Biographie de l'auteur"),'biographie'), "series" => Class_Onglet::forLibelleAndType($translate->_("Documents de la même série"),'series')->setDisplayMethod('checkIfClefChapeauExists'), - "auteur" => Class_Onglet::forLibelleAndType($translate->_("Documents du même auteur"),'auteur'), +// "auteur" => Class_Onglet::forLibelleAndType($translate->_("Documents du même auteur"),'auteur'), "similaires" => Class_Onglet::forLibelleAndType($translate->_("Documents similaires"),'similaires'), "bibliographie" => Class_Onglet::forLibelleAndType($translate->_("Discographie"),'bibliographie'), "morceaux" => Class_Onglet::forLibelleAndType($translate->_("Morceaux"),'morceaux'), diff --git a/library/Class/Onglet.php b/library/Class/Onglet.php index a2dbfae1f3a..95e65a19407 100644 --- a/library/Class/Onglet.php +++ b/library/Class/Onglet.php @@ -25,10 +25,10 @@ class Class_Onglet { protected $libelle; protected $function_name='alwaysDisplay'; // Mode d'affichage 0=aucun 1=bloc déplié 2=bloc fermé 3=dans 1 onglet - protected $display=1; + protected $display=0; protected $largeur=0; // Largeur de l'onglet 0=répartition auto en pourcentage - + protected $order=0; public static function forLibelleAndType($libelle,$type) { return new self($libelle,$type); } diff --git a/library/ZendAfi/View/Helper/Notice/Abstract.php b/library/ZendAfi/View/Helper/Notice/Abstract.php index 2edc4a730f8..da89e917094 100644 --- a/library/ZendAfi/View/Helper/Notice/Abstract.php +++ b/library/ZendAfi/View/Helper/Notice/Abstract.php @@ -44,13 +44,15 @@ abstract class ZendAfi_View_Helper_Notice_Abstract extends Zend_View_Helper_Html $onglet = Class_Codification::getInstance()->getOnglet($nom); if ($config['titre']) $onglet->setLibelle($config['titre']); + $onglet->setOrder($config['ordre']); + $onglet->setDisplayMode($config["aff"]); $onglets[] = $onglet; } - -/* uasort($onglets, + xdebug_break(); + uasort($onglets, function($cfg_a, $cfg_b) { - return (int)$cfg_a['ordre'] - (int)$cfg_b['ordre']; - });*/ + return (int)$cfg_a->getOrder() - (int)$cfg_b->getOrder(); + }); return $onglets; } diff --git a/library/ZendAfi/View/Helper/Notice/Entete.php b/library/ZendAfi/View/Helper/Notice/Entete.php index c9eb490a7ab..f4f4ed66613 100644 --- a/library/ZendAfi/View/Helper/Notice/Entete.php +++ b/library/ZendAfi/View/Helper/Notice/Entete.php @@ -32,7 +32,7 @@ class ZendAfi_View_Helper_Notice_Entete extends Zend_View_Helper_HtmlElement { } - public function addSeries($notice) { + public function addSeries($notice,$view) { if (strlen($notice->getClefChapeau())<1) return ''; $criteres = new Class_CriteresRecherche(); @@ -40,7 +40,7 @@ class ZendAfi_View_Helper_Notice_Entete extends Zend_View_Helper_HtmlElement { $message = 'Voir tous les documents de la série.'; if ($notice->isPeriodique()) $message = 'Voir tous les numéros de '.$notice->getTitrePrincipal(); - $html = '<dt class="serie"></dt><dd class="serie"><a href="'.$this->view->url( $criteres -> getNewUrlCriteresSerie($serie)).'">'.$message.'</a></dd>'; + $html = '<dd class="serie"><a href="'.$view->url( $criteres -> getNewUrlCriteresSerie($serie)).'">'.$message.'</a></dd>'; return $html; } @@ -76,7 +76,7 @@ class ZendAfi_View_Helper_Notice_Entete extends Zend_View_Helper_HtmlElement { $i++; } - $html .= $this->addSeries($notice); + $html .= $this->addSeries($notice,$this->view); $html.='</dl>'; return $html; } diff --git a/tests/application/modules/admin/controllers/AdminIndexControllerTest.php b/tests/application/modules/admin/controllers/AdminIndexControllerTest.php index 634c9619d36..7ae39eec654 100644 --- a/tests/application/modules/admin/controllers/AdminIndexControllerTest.php +++ b/tests/application/modules/admin/controllers/AdminIndexControllerTest.php @@ -145,7 +145,7 @@ class AdminIndexControllerAdminVarActionTest extends Admin_AbstractControllerTes /** @test */ public function titleShouldBeGestionDesVariables() { - $this->assertXpathContentContains('//h1', 'Gestion des variables'); + $this->assertXpathContentContains('//h1', 'Gestion des variables',$this->_response->getBody()); } /** @test */ diff --git a/tests/application/modules/opac/controllers/RechercheControllerTest.php b/tests/application/modules/opac/controllers/RechercheControllerTest.php index 9274eb03d91..008e9e46ae2 100644 --- a/tests/application/modules/opac/controllers/RechercheControllerTest.php +++ b/tests/application/modules/opac/controllers/RechercheControllerTest.php @@ -218,7 +218,7 @@ class RechercheControllerViewNoticeWithPreferencesTest extends RechercheControll /** @test */ public function frbrOngletShouldHaveIdSet345_onglet_3() { - $this->assertXPathContentContains('//div[@id="set345_onglet_3"][@class="titre_onglet"]', 'frbr'); + $this->assertXPathContentContains('//div[@id="set345_onglet_3"][@class="titre_onglet"]', 'frbr',$this->_response->getBody()); } /** @test */ diff --git a/tests/application/modules/telephone/controllers/RechercheControllerHarryPotterTest.php b/tests/application/modules/telephone/controllers/RechercheControllerHarryPotterTest.php index 3e534bde65d..9794d02784f 100644 --- a/tests/application/modules/telephone/controllers/RechercheControllerHarryPotterTest.php +++ b/tests/application/modules/telephone/controllers/RechercheControllerHarryPotterTest.php @@ -147,7 +147,7 @@ class Telephone_RechercheControllerHarryPotterViewNoticeTest extends Telephone_R /** @test */ public function pageShouldContainsLinkToNoticesMemeSerie() { - $this->assertXPathContentContains('//a[contains(@href, "recherche/series/id/4")]', 'Documents de la même série',$this->_response->getBody()); + $this->assertXPathContentContains('//a[contains(@href, "recherche/simple/id/4/serie/HARRY+POTTER")]', 'documents de la série',$this->_response->getBody()); } diff --git a/tests/library/Class/AdminVarTest.php b/tests/library/Class/AdminVarTest.php index bc781d20538..3ad62b5c9fa 100644 --- a/tests/library/Class/AdminVarTest.php +++ b/tests/library/Class/AdminVarTest.php @@ -36,7 +36,6 @@ class AdminVarTestGet extends AdminVarTestCase { public function setup() { Class_AdminVar::set('WORKFLOW_TEXT_MAIL_ARTICLE_PENDING',''); Class_AdminVar::set('WORKFLOW_TEXT_MAIL_ARTICLE_REFUSED',''); - Class_AdminVar::setDefaultValuesForWorkflowMessage(); } public function testGetReturnsValeur() { @@ -122,13 +121,13 @@ class AdminVarTestGet extends AdminVarTestCase { /** @test */ public function workflowTextMailArticlePendingShouldHaveDefaultTextNouvelArticleAValider() { - $this->assertEquals('Un nouvel article est à valider. TITRE_ARTICLE URL_ARTICLE',Class_AdminVar::get('WORKFLOW_TEXT_MAIL_ARTICLE_PENDING')); + $this->assertEquals('Un nouvel article est à valider. TITRE_ARTICLE URL_ARTICLE',Class_AdminVar::getWorkflowTextMailArticlePending()); } /** @test */ public function workflowTextMailArticleRefusedShouldHaveDefaultTextArticleRefuse() { - $this->assertEquals('L\'article a été refusé.',Class_AdminVar::get('WORKFLOW_TEXT_MAIL_ARTICLE_REFUSED')); + $this->assertEquals('L\'article a été refusé.',Class_AdminVar::getWorkflowTextMailArticleRefused()); } -- GitLab