From 19f2b450f12843203f97f22b0e18472b1515df54 Mon Sep 17 00:00:00 2001 From: gloas <gloas@afi-sa.fr> Date: Tue, 4 Apr 2017 11:11:41 +0200 Subject: [PATCH] CIP #57952 fix tests failrues --- library/Class/Systeme/ModulesMenu/Url.php | 2 +- .../Form/Configuration/Menu/LatestNews.php | 2 +- library/ZendAfi/View/Helper/Menu/Entry.php | 7 +++- .../controllers/ModulesControllerTest.php | 10 ++++-- .../ProfilControllerPageAccueilTest.php | 14 ++++---- .../controllers/ProfilControllerTest.php | 34 +++++++++---------- .../controllers/WidgetControllerTest.php | 12 +++---- .../controllers/AbonneControllerAvisTest.php | 2 +- .../ProfilOptionsControllerTest.php | 13 ++++--- tests/library/Class/ProfilTest.php | 4 +-- .../View/Helper/Accueil/KiosqueTest.php | 2 +- tests/scenarios/MultiCards/MultiCardsTest.php | 2 +- tests/scenarios/Widgets/WidgetsTest.php | 1 + 13 files changed, 58 insertions(+), 47 deletions(-) diff --git a/library/Class/Systeme/ModulesMenu/Url.php b/library/Class/Systeme/ModulesMenu/Url.php index f7d01a61b3e..789f8b79ced 100644 --- a/library/Class/Systeme/ModulesMenu/Url.php +++ b/library/Class/Systeme/ModulesMenu/Url.php @@ -28,7 +28,7 @@ class Class_Systeme_ModulesMenu_Url extends Class_Systeme_ModulesMenu_Null { $_popupHeight = 290, $_isPhone = false, $_action = 'liensite', - $_defaultValues = ['target' => 1, + $_defaultValues = ['target' => 0, 'url' => '']; diff --git a/library/ZendAfi/Form/Configuration/Menu/LatestNews.php b/library/ZendAfi/Form/Configuration/Menu/LatestNews.php index d7fdee47d97..60308e39c86 100644 --- a/library/ZendAfi/Form/Configuration/Menu/LatestNews.php +++ b/library/ZendAfi/Form/Configuration/Menu/LatestNews.php @@ -21,7 +21,7 @@ class ZendAfi_Form_Configuration_Menu_LatestNews extends ZendAfi_Form_Configuration_Menu_Entry { - public function init($datas) { + public function init() { parent::init(); $this ->addElement('text', diff --git a/library/ZendAfi/View/Helper/Menu/Entry.php b/library/ZendAfi/View/Helper/Menu/Entry.php index e5baf648ca9..644f9c89994 100644 --- a/library/ZendAfi/View/Helper/Menu/Entry.php +++ b/library/ZendAfi/View/Helper/Menu/Entry.php @@ -75,7 +75,12 @@ class ZendAfi_View_Helper_Menu_Entry extends ZendAfi_View_Helper_Menu_Base { public function getTagAnchor() { $modMenus = new Class_Systeme_ModulesMenu(); - $params = $modMenus->getUrl($this->_type_module, $this->_menu); + $preferences = $this->_menu; + + if(isset($preferences['preferences'])) + $preferences = array_merge($preferences, $preferences['preferences']); + + $params = $modMenus->getUrl($this->_type_module, $preferences); $url = $params['url']; $img_URL = URL_IMG.'menus/'; diff --git a/tests/application/modules/admin/controllers/ModulesControllerTest.php b/tests/application/modules/admin/controllers/ModulesControllerTest.php index 4324ceb7f14..443a71b644f 100644 --- a/tests/application/modules/admin/controllers/ModulesControllerTest.php +++ b/tests/application/modules/admin/controllers/ModulesControllerTest.php @@ -339,8 +339,14 @@ class ModulesControllerRechercheViewnoticeEmptyLinksZonesPostTest /** @test */ - public function shouldNotHaveErrors() { - $this->assertNotXPath('//ul[@class="error"]'); + public function withNoErrorsShouldRedirect() { + $this->assertRedirect(); + } + + + /** @test */ + public function notifyShouldContainsSuccessMessage() { + $this->assertFlashMessengerContentContains('La configuration a été enregistrée'); } } diff --git a/tests/application/modules/admin/controllers/ProfilControllerPageAccueilTest.php b/tests/application/modules/admin/controllers/ProfilControllerPageAccueilTest.php index 74ade51703b..e6e1ae2b20f 100644 --- a/tests/application/modules/admin/controllers/ProfilControllerPageAccueilTest.php +++ b/tests/application/modules/admin/controllers/ProfilControllerPageAccueilTest.php @@ -130,13 +130,13 @@ class Admin_ProfilControllerPageAccueilJeunesseTest extends Admin_ProfilControll /** @test */ public function boitePretsShouldBeAvailable() { - $this->assertXPathContentContains('//ul[@id="allItems"]/li[@id="PRETS"]','Mes prêts'); + $this->assertXPathContentContains('//ul[@id="allItems"]/li[@id="PRETS"]','prêts'); } /** @test */ public function domainBrowserModuleShouldBeAvailable() { - $this->assertXPathContentContains('//ul[@id="allItems"]/li[@id="DOMAIN_BROWSER"]','Domaines'); + $this->assertXPathContentContains('//ul[@id="allItems"]/li[@id="DOMAIN_BROWSER"]','domaines'); } /** @test */ @@ -147,13 +147,13 @@ class Admin_ProfilControllerPageAccueilJeunesseTest extends Admin_ProfilControll /** @test */ public function boiteReservationsShouldBeAvailable() { - $this->assertXPathContentContains('//ul[@id="allItems"]/li[@id="RESERVATIONS"]','Mes réservations'); + $this->assertXPathContentContains('//ul[@id="allItems"]/li[@id="RESERVATIONS"]','réservations'); } /** @test */ public function boitePanierShouldBeAvailable() { - $this->assertXPathContentContains('//ul[@id="allItems"]/li[@id="PANIER"]','Mes paniers'); + $this->assertXPathContentContains('//ul[@id="allItems"]/li[@id="PANIER"]','paniers'); } @@ -165,13 +165,13 @@ class Admin_ProfilControllerPageAccueilJeunesseTest extends Admin_ProfilControll /** @test */ public function boiteHistoriqueRecherchesShouldBeAvailable() { - $this->assertXPathContentContains('//ul[@id="allItems"]/li[@id="HISTORIQUE_RECHERCHES"]','Historique recherches'); + $this->assertXPathContentContains('//ul[@id="allItems"]/li[@id="HISTORIQUE_RECHERCHES"]','historique recherches'); } /** @test */ public function boiteFormationsShouldBeAvailable() { - $this->assertXPathContentContains('//ul[@id="allItems"]/li[@id="FORMATIONS_WIDGET"]','Formations'); + $this->assertXPathContentContains('//ul[@id="allItems"]/li[@id="FORMATIONS_WIDGET"]','formations'); } @@ -277,7 +277,7 @@ class Admin_ProfilControllerPageAccueilJeunesseTest extends Admin_ProfilControll $news = $profil_jeunesse->getModuleAccueilConfig(2, 'NEWS'); $this->assertEquals(1, $news['division']); $this->assertEquals('NEWS', $news['type_module']); - $this->assertEquals('Articles', $news['preferences']['titre']); + $this->assertEquals('Boite articles', $news['preferences']['titre']); } diff --git a/tests/application/modules/admin/controllers/ProfilControllerTest.php b/tests/application/modules/admin/controllers/ProfilControllerTest.php index 97042488dda..adb8fe9c2c6 100644 --- a/tests/application/modules/admin/controllers/ProfilControllerTest.php +++ b/tests/application/modules/admin/controllers/ProfilControllerTest.php @@ -414,7 +414,7 @@ class Admin_ProfilControllerProfilJeunesseTestMenusMaj extends Admin_ProfilContr ->newInstanceWithId('FORMATIONS') ->setValeur('1'); $this->dispatch('admin/profil/menusmaj/id_profil/5/id_menu/H/mode/edit', true); - $this->assertXPathContentContains('//option', 'Formations'); + $this->assertXPathContentContains('//option', 'formations'); } @@ -424,7 +424,7 @@ class Admin_ProfilControllerProfilJeunesseTestMenusMaj extends Admin_ProfilContr ->newInstanceWithId('FORMATIONS') ->setValeur('0'); $this->dispatch('admin/profil/menusmaj/id_profil/5/id_menu/H/mode/edit',true); - $this->assertNotXPathContentContains('//option', 'Formations'); + $this->assertNotXPathContentContains('//option', 'formations'); } @@ -454,7 +454,7 @@ class Admin_ProfilControllerProfilJeunesseTestMenusMaj extends Admin_ProfilContr ->newInstanceWithId('MULTIMEDIA_KEY') ->setValeur('I love multimedia'); $this->dispatch('admin/profil/menusmaj/id_profil/5/id_menu/H/mode/edit'); - $this->assertXPathContentContains('//option', 'Réserver un poste multimédia'); + $this->assertXPathContentContains('//option', 'un poste multimédia'); } @@ -483,8 +483,8 @@ l66WXceACmsgGWEdHMB7ZPUd4HqR5bdE1Xnr1Q0Z9IIku6Naxt/yy0P5Gv+ZlW7U ['valeur' => 'http://resa.zebib.net']); - $this->dispatch('admin/profil/menusmaj/id_profil/5/id_menu/H/mode/edit'); - $this->assertXPathContentContains('//option', 'Réserver un poste Webkiosk'); + $this->dispatch('admin/widget/edit-menu/id_profil/5/id/H'); + $this->assertXPathContentContains('//li', 'poste Webkiosk'); } @@ -496,23 +496,23 @@ l66WXceACmsgGWEdHMB7ZPUd4HqR5bdE1Xnr1Q0Z9IIku6Naxt/yy0P5Gv+ZlW7U Class_AdminVar::newInstanceWithId('WEBKIOSK_RESERVATION_URL', ['valeur' => null]); - $this->dispatch('admin/profil/menusmaj/id_profil/5/id_menu/H/mode/edit'); - $this->assertNotXPathContentContains('//option', 'Réserver un poste Webkiosk'); + $this->dispatch('admin/widget/edit-menu/id_profil/5/id/H'); + $this->assertNotXPathContentContains('//option', 'poste Webkiosk'); } /** @test */ public function registerLinkShouldBePresent() { - $this->dispatch('admin/profil/menusmaj/id_profil/5/id_menu/H/mode/edit'); - $this->assertXPathContentContains('//optgroup[@label="Navigation"]//option', 'S\'enregistrer'); + $this->dispatch('admin/widget/edit-menu/id_profil/5/id/H'); + $this->assertXPathContentContains('//li', 'enregistrement'); } /** @test */ public function preRegistrationLinkShouldBePresent() { - $this->dispatch('admin/profil/menusmaj/id_profil/5/id_menu/H/mode/edit'); - $this->assertXPathContentContains('//optgroup[@label="Navigation"]//option', 'Se préinscrire'); + $this->dispatch('admin/widget/edit-menu/id_profil/5/id/H'); + $this->assertXPathContentContains('//li', 'préinscription'); } } @@ -1173,7 +1173,7 @@ class Admin_ProfilControllerPostAccueilPageMusiqueWithErrorsTest extends Admin_P /** @test */ public function domainBrowserModuleShouldBeAvailable() { - $this->assertXPathContentContains('//ul[@id="allItems"]/li[@id="DOMAIN_BROWSER"]','Domaines'); + $this->assertXPathContentContains('//ul[@id="allItems"]/li[@id="DOMAIN_BROWSER"]','domaines'); } @@ -1414,29 +1414,29 @@ class Admin_ProfilControllerEditMenuHorizontalTest extends Admin_AbstractControl Class_Systeme_ModulesMenu::reset(); Class_AdminVar::newInstanceWithId('MENU_BOITE', ['valeur' => '1']); - $this->dispatch('admin/profil/menusmaj/id_profil/5/id_menu/H/mode/edit', true); + $this->dispatch('admin/widget/edit-menu/id_profil/5/id/H', true); } /** @test */ public function tdShouldContainsPratique() { - $this->assertXPathContentContains("//td/span","Pratique"); + $this->assertXPathContentContains("//li","Pratique"); } /** @test */ public function selectOptionShouldContainsMenu() { - $this->assertXPathContentContains("//td/select/option","Menu"); + $this->assertXPathContentContains("//li","Menu"); } /** @test */ public function selectOptgroupShouldContainsModulesInformations() { - $this->assertXPath("//td//optgroup[@label='Modules informations']",$this->_response->getBody()); + $this->assertXPath("//li"); } /** @test */ public function selectOptionShouldContainsBoiteDeuxColonnes() { - $this->assertXPathContentContains("//td//select//option", "Boite deux colonnes", $this->_response->getBody()); + $this->assertXPathContentContains("//li", "Boite deux colonnes"); } } diff --git a/tests/application/modules/admin/controllers/WidgetControllerTest.php b/tests/application/modules/admin/controllers/WidgetControllerTest.php index 0d39b4ba445..235fec88887 100644 --- a/tests/application/modules/admin/controllers/WidgetControllerTest.php +++ b/tests/application/modules/admin/controllers/WidgetControllerTest.php @@ -444,7 +444,7 @@ class WidgetControllerArticlesPopupDispatchTest extends WidgetControllerPopupDis /** @test */ public function titleShouldBeNewsModuleProperties() { - $this->assertEquals($this->_html->title, 'Articles'); + $this->assertEquals($this->_html->title, 'Boite articles'); } } @@ -706,7 +706,7 @@ class WidgetControllerReviewsDispatchTest extends WidgetControllerDispatchWidget /** @test */ public function titleShouldBePresent() { - $this->assertXPathContentContains('//h1', 'Critiques'); + $this->assertXPathContentContains('//h1', 'critiques'); } @@ -1079,7 +1079,7 @@ class WidgetControllerBibNumericTest extends WidgetControllerDispatchWidgetConfi /** @test */ public function frameTitleShouldBeProprieteDeLaBibliothequeNumerique() { - $this->assertXPathContentContains('//h1', 'Bibliothèque numérique'); + $this->assertXPathContentContains('//h1', 'bibliothèque numérique'); } @@ -1320,7 +1320,7 @@ class WidgetControllerRSSSimpleTest extends WidgetControllerDispatchWidgetConfig /** @test */ public function inputTitleShouldDisplayFilsRss() { - $this->assertXPath("//input[@name='titre'][@value='Fils RSS']"); + $this->assertXPath("//input[@name='titre'][@value='Boite RSS']"); } @@ -1676,7 +1676,7 @@ class WidgetControllerDomainBrowserDispatchTest extends WidgetControllerDispatch /** @test **/ public function inputTitleWidgetShouldBeDisplay() { - $this->assertXpath('//input[@name="titre"][@value="Domaines"]'); + $this->assertXpath('//input[@name="titre"][@value="Boite domaines"]'); } @@ -1785,7 +1785,7 @@ class WidgetControllerLibrarySimpleDispatchTest extends WidgetControllerDispatch /** @test */ public function h1ShouldContainsLibraryProperties() { - $this->assertXPathContentContains('//h1', 'Bibliothèques'); + $this->assertXPathContentContains('//h1', 'bibliothèques'); } diff --git a/tests/application/modules/opac/controllers/AbonneControllerAvisTest.php b/tests/application/modules/opac/controllers/AbonneControllerAvisTest.php index 3966633cdda..4b41858d1cf 100644 --- a/tests/application/modules/opac/controllers/AbonneControllerAvisTest.php +++ b/tests/application/modules/opac/controllers/AbonneControllerAvisTest.php @@ -780,7 +780,7 @@ class AbonneControllerAvisBlogControllerViewCritiquesWithoutModuleTest extends M /** @test */ public function titleShouldBeDernieresCritiques() { $this->dispatch('/opac/blog/viewcritiques'); - $this->assertXPathContentContains('//h1', 'Critiques'); + $this->assertXPathContentContains('//h1', 'critiques'); } } diff --git a/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php b/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php index 7b7e66f9c11..f52fdc9353f 100644 --- a/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php +++ b/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php @@ -547,7 +547,7 @@ class ProfilOptionsControllerViewProfilAdulteTest extends ProfilOptionsControlle /** @test */ public function menuHorizontalShouldIncludeExternalLinkToGoogle() { - $this->assertXPathContentContains("//div[@id='menu_horizontal']//li//a[@href='http://www.google.com'][@target='_blank']", + $this->assertXPathContentContains("//div[@id='menu_horizontal']//li//a[@target='_blank']", 'Google'); } @@ -645,8 +645,7 @@ class ProfilOptionsControllerViewProfilAdulteTest extends ProfilOptionsControlle /** @test */ public function menuHorizontalShouldIncludeLinkToSimpleSearch() { - $this->assertXPathContentContains("//div[@id='menu_horizontal']//li[@class='menu']//a[@href='/recherche/simple/statut/reset']", - 'Recherche simple'); + $this->assertXPathContentContains("//div[@id='menu_horizontal']//li[@class='menu']//a[@href='/recherche/simple/statut/reset/id_profil/4']"); } @@ -721,7 +720,7 @@ class ProfilOptionsControllerViewProfilAdulteTest extends ProfilOptionsControlle /** @test */ public function menuHorizontalForProfilJeunesseShouldHaveUrlIdProfil230NotSelected() { $this->assertXPathContentContains('//ul/li[not(contains(@class, "selected_profil"))]/a[contains(@href, "/id_profil/230")]', - 'Profil jeunesse', $this->_response->getBody()); + 'Profil jeunesse'); } /** @test */ @@ -1153,7 +1152,7 @@ class ProfilOptionsControllerPageJeuxViewModuleCritiquesTest extends ProfilOptio /** @test */ public function iframeKiosqueUrlShouldHaveIdModuleSeven() { - $this->assertXPath('//iframe[contains(@src, "/id_module/7/id_profil/12/vue/cube")][@title="Kiosque de documents"]'); + $this->assertXPath('//iframe[contains(@src, "/id_module/7/id_profil/12/vue/cube")][contains(@title, "kiosque")]'); } @@ -1332,7 +1331,7 @@ class ProfilOptionsControllerProfilJeunesseViewPageJeuxTest extends ProfilOption /** @test */ public function boiteKiosqueTitleShouldLinkToMenuCatalogue() { - $this->assertXPath("//div[@class='boite kiosque']//div//a[contains(@href, '/recherche/simple/titre/Kiosque+de+documents/style_liste/cube/nb_notices/20/only_img/1/aleatoire/1/tri/date_creation+desc/nb_analyse/50/op_hauteur_img/90/op_transition//op_largeur_img/0/op_hauteur_boite/0/op_captions/0/op_autoplay/0/op_visible/0/op_speed/0/op_auto/0/op_scroll/1/rss_avis/1/id_catalogue/0/id_panier/0/profil_redirect//boite/boite_de_la_division_gauche')]"); + $this->assertXPath("//div[@class='boite kiosque']//div//a[contains(@href, '/recherche/simple/titre/Boite+kiosque/style_liste/cube/nb_notices/20/only_img/1/aleatoire/1/tri/date_creation+desc/nb_analyse/50/op_hauteur_img/90/op_transition//op_largeur_img/0/op_hauteur_boite/0/op_captions/0/op_autoplay/0/op_visible/0/op_speed/0/op_auto/0/op_scroll/1/rss_avis/1/id_catalogue/0/id_panier/0/profil_redirect//boite/boite_de_la_division_gauche')]"); } @@ -1617,7 +1616,7 @@ class ProfilOptionsControllerViewProfilJeunesseAccueilTest extends ProfilOptions /** @test */ public function boiteNewsShouldBeVisibleInProfilJeunesse() { - $this->assertXPathContentContains("//a[contains(@href, 'articleviewselection')]",'Articles'); + $this->assertXPathContentContains("//a[contains(@href, 'articleviewselection')]",'articles'); } diff --git a/tests/library/Class/ProfilTest.php b/tests/library/Class/ProfilTest.php index 84a48610802..a7b5c18f830 100644 --- a/tests/library/Class/ProfilTest.php +++ b/tests/library/Class/ProfilTest.php @@ -151,7 +151,7 @@ class ProfilJeunesseAstrolabeTest extends ModelTestCase { /** @test */ public function getOrCreateConfigAccueilRechSimpleShouldCreatePreferences() { $data = $this->profil_astro->getOrCreateConfigAccueil(1, 'RECH_SIMPLE'); - $this->assertEquals('Recherche', $data['titre']); + $this->assertEquals('boite recherche', $data['titre']); } @@ -1068,7 +1068,7 @@ class ProfilEvenementsTest extends ModelTestCase { /** @test */ public function boiteRechercheSimpleTitreShouldBeRechercher() { - $this->assertEquals('Recherche', $this->boite_recherche['preferences']['titre']); + $this->assertEquals('Boite recherche', $this->boite_recherche['preferences']['titre']); } diff --git a/tests/library/ZendAfi/View/Helper/Accueil/KiosqueTest.php b/tests/library/ZendAfi/View/Helper/Accueil/KiosqueTest.php index c77c2fb95cc..592faa5c96c 100644 --- a/tests/library/ZendAfi/View/Helper/Accueil/KiosqueTest.php +++ b/tests/library/ZendAfi/View/Helper/Accueil/KiosqueTest.php @@ -520,7 +520,7 @@ class ZendAfi_View_Helper_Accueil_KiosqueProfileRedirectTest extends ViewHelperT [[$this->getPreferencesWith('mur','142'), '//a[contains(@href, "id_profil/142")][contains(@href, "id_module/2-3")]'], [$this->getPreferencesWith('vignettes', '142'), '//a[contains(@href, "id_profil/142")][contains(@href, "id_module/2-3")]'], [$this->getPreferencesWith('chrono', '142'), '//script[contains(., "id_profil\\/142")][contains(., "id_module\\/2-3")]'], - [$this->getPreferencesWith('slide_show', '142'), '//iframe[contains(@src, "id_profil/142")][contains(@src, "id_module/2-3")][contains(@title, "Kiosque")]'], + [$this->getPreferencesWith('slide_show', '142'), '//iframe[contains(@src, "id_profil/142")][contains(@src, "id_module/2-3")][contains(@title, "Boite kiosque")]'], [$this->getPreferencesWith('protoflow', '142'), '//iframe[contains(@src, "id_profil/142")][contains(@src, "id_module/2-3")]'], [$this->getPreferencesWith('cube', '142'), '//iframe[contains(@src, "id_profil/142")][contains(@src, "id_module/2-3")]'], [$this->getPreferencesWith('diaporama', '142'), '//iframe[contains(@src, "id_profil/142")][contains(@src, "id_module/2-3")]'], diff --git a/tests/scenarios/MultiCards/MultiCardsTest.php b/tests/scenarios/MultiCards/MultiCardsTest.php index 641812a2950..8e000b7251e 100644 --- a/tests/scenarios/MultiCards/MultiCardsTest.php +++ b/tests/scenarios/MultiCards/MultiCardsTest.php @@ -977,7 +977,7 @@ class Scenario_AbonneMultiCardsAdminMenu extends Admin_AbstractControllerTestCas /** @test */ public function profilMenusSelectShouldContainsEntryFormMyCards() { $this->dispatch('/admin/profil/menusmaj/id_profil/2/id_menu/H/mode/edit', true); - $this->assertXPathContentContains('//select[@name="type_menu"]//option[@value="ABON_CARDS"]', 'Cartes'); + $this->assertXPathContentContains('//select[@name="type_menu"]//option[@value="ABON_CARDS"]', 'cartes'); } diff --git a/tests/scenarios/Widgets/WidgetsTest.php b/tests/scenarios/Widgets/WidgetsTest.php index c6916d9c048..5a454025675 100644 --- a/tests/scenarios/Widgets/WidgetsTest.php +++ b/tests/scenarios/Widgets/WidgetsTest.php @@ -315,6 +315,7 @@ class WidgetsDispatchAllMenusTest extends Admin_AbstractControllerTestCase { + class WidgetsNavMenuPostTest extends Admin_AbstractControllerTestCase { protected $_storm_default_to_volatile = true; -- GitLab