From 1395a020b1d6dbf92cdbc15a633164de100d03df Mon Sep 17 00:00:00 2001 From: gloas <gloas@afi-sa.fr> Date: Wed, 18 Apr 2018 14:22:27 +0200 Subject: [PATCH] hotline #74120 fix rt comments --- library/ZendAfi/View/Helper/ComboCodification.php | 4 ++-- tests/library/ZendAfi/View/Helper/TagRechercheSimpleTest.php | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/library/ZendAfi/View/Helper/ComboCodification.php b/library/ZendAfi/View/Helper/ComboCodification.php index b42e14e2df6..feb19a98879 100644 --- a/library/ZendAfi/View/Helper/ComboCodification.php +++ b/library/ZendAfi/View/Helper/ComboCodification.php @@ -24,7 +24,7 @@ class ZendAfi_View_Helper_ComboCodification extends ZendAfi_View_Helper_BaseHelp const SECTION = 'section'; public function ComboCodification($type, $valeur_select, $events = '') { - if(!$valeur_select) + if(null === $valeur_select) $valeur_select = []; if(!is_array($valeur_select)) @@ -64,7 +64,7 @@ class ZendAfi_View_Helper_ComboCodification extends ZendAfi_View_Helper_BaseHelp $combo = '<select id="' . $id . '" name="' . $name . '"' . $events . ' class="typeDoc">'; foreach ($items as $item) { - $selected = $item['value'] == reset($valeur_select) ? ' selected="selected"': ''; + $selected = $item['value'] === reset($valeur_select) ? ' selected="selected"': ''; $combo .= '<option value="' . $item["value"] . '"' . $selected.'>' . stripSlashes($item["libelle"]) . '</option>'; } $combo .= '</select>'; diff --git a/tests/library/ZendAfi/View/Helper/TagRechercheSimpleTest.php b/tests/library/ZendAfi/View/Helper/TagRechercheSimpleTest.php index 7eb283b3dff..c5292c70bd1 100644 --- a/tests/library/ZendAfi/View/Helper/TagRechercheSimpleTest.php +++ b/tests/library/ZendAfi/View/Helper/TagRechercheSimpleTest.php @@ -398,6 +398,7 @@ class ZendAfi_View_Helper_TagRechercheSimpleDocTypeTest extends ZendAfi_View_Hel $this->preferences['type_doc'] = ''; $this->_html = $this->_helper->tagRechercheSimple($this->preferences, 1); $this->assertXPathContentContains($this->_html, '//option[@value=""][@selected]', 'tous'); + $this->assertXPathContentContains($this->_html, '//option[@value="0"][not(@selected)]', 'Non identifi'); } @@ -414,5 +415,6 @@ class ZendAfi_View_Helper_TagRechercheSimpleDocTypeTest extends ZendAfi_View_Hel $this->preferences['type_doc'] = '0'; $this->_html = $this->_helper->tagRechercheSimple($this->preferences, 1); $this->assertXPathContentContains($this->_html, '//option[@value="0"][@selected]', 'Non identifi'); + $this->assertXPathContentContains($this->_html, '//option[@value=""][not(@selected)]', 'tous'); } } \ No newline at end of file -- GitLab