From ba804758a575a56b59ccb50518b7a40d1403e57b Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT <hdlaurent@afi-sa.net> Date: Thu, 20 Feb 2025 10:21:51 +0100 Subject: [PATCH] Fix ZendAfi Form Call --- .../Class/WebService/SIGB/Koha/BuySuggestForm.php | 2 +- .../WebService/SIGB/Nanook/BuySuggestForm.php | 2 +- library/ZendAfi/View/Helper/Search/Display.php | 3 +-- library/ZendAfi/View/Helper/Search/Order.php | 2 +- library/ZendAfi/View/Helper/Search/PageSize.php | 2 +- library/ZendAfi/View/Helper/Search/SearchMode.php | 2 +- .../AbonneControllerSuggestionAchatNanookTest.php | 15 ++++++++++++++- tests/scenarios/RGAA/SearchResultsPageTest.php | 14 ++++++++++++++ 8 files changed, 34 insertions(+), 8 deletions(-) diff --git a/library/Class/WebService/SIGB/Koha/BuySuggestForm.php b/library/Class/WebService/SIGB/Koha/BuySuggestForm.php index 5e300532211..3be75e7adf5 100644 --- a/library/Class/WebService/SIGB/Koha/BuySuggestForm.php +++ b/library/Class/WebService/SIGB/Koha/BuySuggestForm.php @@ -64,7 +64,7 @@ class Class_WebService_SIGB_Koha_BuySuggestForm extends ZendAfi_Form_SuggestionA ->addElement('text', 'BranchName', ['label' => $this->_('Site'), 'value' => Class_Users::getIdentity()->getLibraryLabel(), - 'disabled' => true]) + 'disabled' => 'disabled']) ->addElement('select', 'DocType', ['label' => $this->_('Type de document').' *', 'multioptions' => $sorted_type_docs, diff --git a/library/Class/WebService/SIGB/Nanook/BuySuggestForm.php b/library/Class/WebService/SIGB/Nanook/BuySuggestForm.php index 3d4a3e9b6bf..74edf4ffc56 100644 --- a/library/Class/WebService/SIGB/Nanook/BuySuggestForm.php +++ b/library/Class/WebService/SIGB/Nanook/BuySuggestForm.php @@ -74,7 +74,7 @@ class Class_WebService_SIGB_Nanook_BuySuggestForm extends ZendAfi_Form_Suggestio 'Library', ['label' => $this->_('Site'), 'value' => Class_Users::getIdentity()->getLibelleBib(), - 'disabled' => true]) + 'disabled' => 'disabled']) ->addElement('select', 'DocType', ['label' => $this->_('Type de document').' *', 'multioptions' => $sorted_type_docs, diff --git a/library/ZendAfi/View/Helper/Search/Display.php b/library/ZendAfi/View/Helper/Search/Display.php index 1e39463355e..44c21400187 100644 --- a/library/ZendAfi/View/Helper/Search/Display.php +++ b/library/ZendAfi/View/Helper/Search/Display.php @@ -23,7 +23,7 @@ class ZendAfi_View_Helper_Search_Display extends ZendAfi_View_Helper_BaseHelper { public function search_Display($search_criteria) { - $element = (new Zend_Form) + $element = (new ZendAfi_Form) ->createElement('select', 'list_format', ['aria-label' => $this->_('Choisir le mode d\'affichage'), @@ -33,4 +33,3 @@ class ZendAfi_View_Helper_Search_Display extends ZendAfi_View_Helper_BaseHelper return $this->view->selectWidget($element); } } -?> diff --git a/library/ZendAfi/View/Helper/Search/Order.php b/library/ZendAfi/View/Helper/Search/Order.php index 0b1c50ae11d..30daedd0b7d 100644 --- a/library/ZendAfi/View/Helper/Search/Order.php +++ b/library/ZendAfi/View/Helper/Search/Order.php @@ -33,7 +33,7 @@ class ZendAfi_View_Helper_Search_Order extends ZendAfi_View_Helper_BaseHelper { protected function _getSettings($search_criteria) : Zend_Form_Element { - return (new Zend_Form) + return (new ZendAfi_Form) ->createElement('select', 'tri', ['aria-label' => $this->_('Choisir l\'ordre des résultats affichés, recharge la page'), diff --git a/library/ZendAfi/View/Helper/Search/PageSize.php b/library/ZendAfi/View/Helper/Search/PageSize.php index 83486a804ae..8fa6e4e45a7 100644 --- a/library/ZendAfi/View/Helper/Search/PageSize.php +++ b/library/ZendAfi/View/Helper/Search/PageSize.php @@ -22,7 +22,7 @@ class ZendAfi_View_Helper_Search_PageSize extends ZendAfi_View_Helper_BaseHelper { public function search_PageSize($search_criteria) { - $element = (new Zend_Form) + $element = (new ZendAfi_Form) ->createElement('select', 'page_size', ['value' => $search_criteria->getPageSize(), diff --git a/library/ZendAfi/View/Helper/Search/SearchMode.php b/library/ZendAfi/View/Helper/Search/SearchMode.php index 821f9cdb156..dd098fe590f 100644 --- a/library/ZendAfi/View/Helper/Search/SearchMode.php +++ b/library/ZendAfi/View/Helper/Search/SearchMode.php @@ -23,7 +23,7 @@ class ZendAfi_View_Helper_Search_SearchMode extends ZendAfi_View_Helper_BaseHelper { public function search_SearchMode($search_criteria) { - $element = (new Zend_Form) + $element = (new ZendAfi_Form) ->createElement('select', 'in_files', ['aria-label' => $this->_('Choisir les modes de recherche'), diff --git a/tests/application/modules/opac/controllers/AbonneControllerSuggestionAchatNanookTest.php b/tests/application/modules/opac/controllers/AbonneControllerSuggestionAchatNanookTest.php index deca69f9b7b..fadf79adbb4 100644 --- a/tests/application/modules/opac/controllers/AbonneControllerSuggestionAchatNanookTest.php +++ b/tests/application/modules/opac/controllers/AbonneControllerSuggestionAchatNanookTest.php @@ -187,6 +187,13 @@ class AbonneControllerSuggestionAchatNanookAddTest extends AbstractAbonneControl } + /** @test */ + public function pageSuggestionNanookShouldBeHTML5Valid() + { + $this->assertHTML5(); + } + + /** @test */ public function formShouldContainsTextAreaForComment() { $this->assertXPath('//form//textarea[@name="Comment"]'); @@ -219,7 +226,7 @@ class AbonneControllerSuggestionAchatNanookAddTest extends AbstractAbonneControl /** @test */ public function formShouldContainsSite() { - $this->assertXPath('//form//input[@name="Library"][@value="Tatim bib"][@disabled="1"]'); + $this->assertXPath('//form//input[@name="Library"][@value="Tatim bib"][@disabled="disabled"]'); } /** @test */ @@ -241,6 +248,12 @@ class AbonneControllerSuggestionAchatNanookAddTest extends AbstractAbonneControl 'Livres'); } + + /** @test */ + public function submitInputSuggestionNanookShouldHaveAttributeNameSubmitValueEnvoyerAndAriaLabelProposer() + { + $this->assertXPath('//form//input[@type="submit"][@value="Envoyer"][@name="submit"]'); + } } diff --git a/tests/scenarios/RGAA/SearchResultsPageTest.php b/tests/scenarios/RGAA/SearchResultsPageTest.php index 54c534f3c78..92d47df036b 100644 --- a/tests/scenarios/RGAA/SearchResultsPageTest.php +++ b/tests/scenarios/RGAA/SearchResultsPageTest.php @@ -57,4 +57,18 @@ class SearchResultsPageTest { $this->assertXPath('//ul[contains(@class, "result_tools_nav")]//li[contains(@class,"result_search_order")]//select[@title="Trier par"][@aria-label="Choisir l\'ordre des résultats affichés, recharge la page"]'); } + + + /** @test */ + public function orderFormElementShouldBeZendAfiFormElement() + { + $this->assertXPath('//div[contains(@class, "wrapper_zendafi_form_tri")][contains(@class, "inline_form_wrapper_zendafi_form_tri")]'); + } + + + /** @test */ + public function pagesizeFormElementShouldBeZendAfiFormElement() + { + $this->assertXPath('//div[contains(@class, "wrapper_zendafi_form_pagesize")][contains(@class, "inline_form_wrapper_zendafi_form_pagesize")]'); + } } -- GitLab