From be077b972f4446da87782238dac02dc58e55a5c5 Mon Sep 17 00:00:00 2001
From: gloas <gloas@afi-sa.fr>
Date: Tue, 4 Apr 2017 11:34:05 +0200
Subject: [PATCH] CIP #57952 fix tests failures + remove double buttons when
 popup mode

---
 application/modules/admin/views/scripts/cms/edit.phtml         | 3 ++-
 library/ZendAfi/View/Helper/Admin/RenderForm.php               | 3 +++
 .../modules/opac/controllers/ProfilOptionsControllerTest.php   | 2 +-
 tests/library/Class/ProfilTest.php                             | 2 +-
 4 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/application/modules/admin/views/scripts/cms/edit.phtml b/application/modules/admin/views/scripts/cms/edit.phtml
index 020a61d98bc..6fa3862b764 100644
--- a/application/modules/admin/views/scripts/cms/edit.phtml
+++ b/application/modules/admin/views/scripts/cms/edit.phtml
@@ -1,5 +1,6 @@
 <?php
-echo $this->partial('cms/_newsform_head.phtml', ['article' => $this->article]);
+if(!$this->_is_popup)
+  echo $this->partial('cms/_newsform_head.phtml', ['article' => $this->article]);
 if ($this->article->isTraduction())
   $this->form->setOriginal($this->article->getArticleOriginal());
 echo $this->renderForm($this->form);
diff --git a/library/ZendAfi/View/Helper/Admin/RenderForm.php b/library/ZendAfi/View/Helper/Admin/RenderForm.php
index 9400b455e3b..c3152f58144 100644
--- a/library/ZendAfi/View/Helper/Admin/RenderForm.php
+++ b/library/ZendAfi/View/Helper/Admin/RenderForm.php
@@ -37,6 +37,9 @@ class ZendAfi_View_Helper_Admin_RenderForm extends ZendAfi_View_Helper_RenderFor
 
 
   protected function _cloneButtons($form) {
+    if($this->view->isPopup())
+      return '';
+
     if(1 >= count($form->getDisplayGroups()))
       return $this;
 
diff --git a/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php b/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php
index f52fdc9353f..5746e2e4c40 100644
--- a/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php
+++ b/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php
@@ -645,7 +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/id_profil/4']");
+    $this->assertXPathContentContains("//div[@id='menu_horizontal']//li[@class='menu']//a[@href='/recherche/simple/statut/reset/id_profil/4']", 'Recherche');
   }
 
 
diff --git a/tests/library/Class/ProfilTest.php b/tests/library/Class/ProfilTest.php
index a7b5c18f830..22513b4cac4 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('boite recherche', $data['titre']);
+    $this->assertEquals('Boite recherche', $data['titre']);
   }
 
 
-- 
GitLab