diff --git a/VERSIONS_HOTLINE/98553 b/VERSIONS_HOTLINE/98553 new file mode 100644 index 0000000000000000000000000000000000000000..c4eb6c7c224949bbfc10d3a8b3b1244ef61d758f --- /dev/null +++ b/VERSIONS_HOTLINE/98553 @@ -0,0 +1 @@ + - ticket #98553 : Correction de la prise en compte des Captchas sous Chrome (78) \ No newline at end of file diff --git a/application/modules/opac/controllers/AuthController.php b/application/modules/opac/controllers/AuthController.php index 44a256ac0dee0704368a0ec6c0879f257f1d25f0..297bb981c907be0966113f78c60a4f98c553f64e 100644 --- a/application/modules/opac/controllers/AuthController.php +++ b/application/modules/opac/controllers/AuthController.php @@ -378,7 +378,7 @@ class AuthController extends ZendAfi_Controller_Action { return; } - if ('' != $this->_getParam('emailCheck')) + if ('' != $this->_getParam('website')) return $this->_redirect('/'); $this->view->preferences = Class_Profil::getCurrentProfil()->getCfgModulesPreferences('auth', 'register'); @@ -420,7 +420,7 @@ class AuthController extends ZendAfi_Controller_Action { public function newsletterRegisterAction() { - if('' != $this->_request->getParam('emailCheck')) + if('' != $this->_request->getParam('website')) return $this->_redirect('/'); if(!($id_newsletter = $this->_request->getParam('id'))) @@ -554,34 +554,33 @@ class AuthController extends ZendAfi_Controller_Action { return $this->_redirect('opac/index'); } - if ('' != $this->_getParam('emailCheck')) + if ('' != $this->_getParam('website')) return $this->_redirect('/'); $this->view->form = $form->populate(ZendAfi_Filters_Post::filterStatic($this->_request->getParams())); $data = ZendAfi_Filters_Post::filterStatic($this->_request->getPost()); - unset($data['emailCheck']); + unset($data['website']); if ($this->_request->isPost() && $form->isValid($data)) { $pre_registration->send($data); $pre_registration->getErrors()->isEmpty() - ? $this->_preRegistrationSuccess() - : $this->_preRegistrationFailed(implode(BR, $pre_registration->getErrors()->getArrayCopy())); + ? $this->_preRegistrationSuccess($pre_registration) + : $this->_preRegistrationFailed($pre_registration); } } - protected function _preRegistrationFailed($message) { - $this->_helper->notify($message); - $this->_preRegistrationRedirect('pre-registration'); + protected function _preRegistrationFailed($pre_registration) { + $this->_helper->notify(implode(BR, $pre_registration->getErrors()->getArrayCopy())); + $this->_preRegistrationRedirect('pre-registration', $pre_registration); } - protected function _preRegistrationSuccess() { + protected function _preRegistrationSuccess($pre_registration) { $this->_preRegistrationSuccessFull(); - $this->view->library = $this->view->annexe->getBib(); $email = $this->_getParam('email', $this->_getParam('mail', '')); $mail_admin = Class_Profil::getCurrentProfil()->getMailSiteOrPortail(); @@ -601,31 +600,30 @@ class AuthController extends ZendAfi_Controller_Action { $this->_helper->notify($this->_('Un email de confirmation de préinscription vous a été envoyé à l\'adresse %s .', $this->view->tag('b', $email))); - return $this->_preRegistrationRedirect('pre-registration-success'); + return $this->_preRegistrationRedirect('pre-registration-success', $pre_registration); } - protected function _preRegistrationRedirect($action) { - $this->_redirect($this->view->absoluteUrl(array_filter(array_merge(['action' => $action, - 'emailCheck' => null], - $this->_request->getPost())))); + protected function _preRegistrationRedirect($action, $pre_registration) { + $library = $pre_registration->getBib($this->_request->getPost()); + $this->_redirect($this->view->absoluteUrl(['action' => $action, + 'id_bib' => $library->getId()])); } public function preRegistrationSuccessAction() { $this->view->titre = $this->_('Préinscription'); - $this->_preRegistrationSuccessFull(); + $this->view->library = Class_Bib::find($this->_getParam('id_bib')); + $pre_registration = new Class_WebService_SIGB_PreRegistration(); + $this->view->form = $pre_registration->getForm() + ->populate($this->_request->getParams()); } protected function _preRegistrationSuccessFull() { - $pre_registration = new Class_WebService_SIGB_PreRegistration(); - $this->view->branchcode = $pre_registration->getBranchCode($this->_request->getParams()); - $this->view->annexe = Class_CodifAnnexe::findFirstBy(['code' => $this->view->branchcode]); - $this->view->library = $this->view->annexe->getBib(); + $params = $this->_request->getParams(); + $this->view->library = (new Class_WebService_SIGB_PreRegistration())->getBib($params); $this->view->library_label = $this->view->library->getLibelle(); - $this->view->form = $pre_registration->getForm() - ->populate($this->_request->getParams()); } diff --git a/application/modules/opac/controllers/FormulaireController.php b/application/modules/opac/controllers/FormulaireController.php index f51591098a2bc006fd99da3a4c74f84348fe9212..2411f2817fa73bf430e1a78af9d9aee6c763f72d 100644 --- a/application/modules/opac/controllers/FormulaireController.php +++ b/application/modules/opac/controllers/FormulaireController.php @@ -23,10 +23,10 @@ class FormulaireController extends ZendAfi_Controller_Action { $article = Class_Article::find($this->_getParam('id_article')); $post = $this->_request->getPost(); - if ($this->_getParam('emailCheck')) + if ($this->_getParam('website')) return $this->_redirect('/'); - unset($post['emailCheck']); + unset($post['website']); $formulaire = new Class_Formulaire(); $formulaire->setData(serialize($post)) diff --git a/application/modules/opac/controllers/IndexController.php b/application/modules/opac/controllers/IndexController.php index f58922a4de88e46585d8eb81a284bd150aa1acb6..10457f6fea7f7fc8b1a5385f1c067c462860a44b 100644 --- a/application/modules/opac/controllers/IndexController.php +++ b/application/modules/opac/controllers/IndexController.php @@ -71,7 +71,7 @@ class IndexController extends ZendAfi_Controller_Action { public function formulairecontactAction() { - if('' != $this->_getParam('emailCheck')) + if('' != $this->_getParam('website')) $this->_redirect('/'); $this->view->form = new ZendAfi_Form_ContactForm(); diff --git a/library/Class/Article.php b/library/Class/Article.php index ca7ea850da9af6caf3e43064d3a9cad4c1c95697..33ac09b17082c3f8070a6510d598363334ef0df8 100644 --- a/library/Class/Article.php +++ b/library/Class/Article.php @@ -1021,10 +1021,10 @@ class Class_Article extends Storm_Model_Abstract { $end_form = '</form>'; - $antispam_tag = '<input data-spambots="true" autocomplete="off" name="emailCheck" type="text" />'; + $antispam_tag = '<input data-spambots="true" autocomplete="off" name="websiteCheck" type="text" />'; $replaced_form = str_replace($antispam_tag, '', $replaced_form); - if (false === strpos($replaced_form, 'name="emailCheck"')) + if (false === strpos($replaced_form, 'name="websiteCheck"')) $replaced_form = preg_replace('|' . $end_form .'|i', $antispam_tag . $end_form, $replaced_form); diff --git a/library/Class/WebService/SIGB/PreRegistration.php b/library/Class/WebService/SIGB/PreRegistration.php index cc22c45bed758af28c6110eb196cb033944242c4..e9fa4eec3103e10f14bf97a88c707a6c7857429b 100644 --- a/library/Class/WebService/SIGB/PreRegistration.php +++ b/library/Class/WebService/SIGB/PreRegistration.php @@ -45,6 +45,13 @@ class Class_WebService_SIGB_PreRegistration { } + public function getBib($data) { + $code = $this->getBranchCode($data); + $annex = Class_CodifAnnexe::findFirstBy(['code' => $code]); + return $annex->getBib(); + } + + protected function getStrategy() { if ($this->_strategy) return $this->_strategy; @@ -108,8 +115,8 @@ class Class_WebService_SIGB_PreRegistrationAbstract { -class Class_WebService_SIGB_PreRegistrationNanook extends Class_WebService_SIGB_PreRegistrationAbstract{ +class Class_WebService_SIGB_PreRegistrationNanook extends Class_WebService_SIGB_PreRegistrationAbstract{ public function getForm() { return new ZendAfi_Form_PreRegistration_Nanook(); } @@ -127,7 +134,9 @@ class Class_WebService_SIGB_PreRegistrationNanook extends Class_WebService_SIGB_ public function getBranchCode($data) { - return $data['site']; + return isset($data['site']) + ? $data['site'] + : 0; } } diff --git a/library/ZendAfi/Form/ContactForm.php b/library/ZendAfi/Form/ContactForm.php index bb3dad2c531786991ff231774211223700b59cee..47857891bdc4160ba4b1e97c12cf606f87daff8d 100644 --- a/library/ZendAfi/Form/ContactForm.php +++ b/library/ZendAfi/Form/ContactForm.php @@ -101,7 +101,8 @@ class ZendAfi_Form_ContactForm extends ZendAfi_Form { 'validators' => ['NoHtml'] ]) - ->addElement('text', 'emailCheck', ['data-spambots' => 'true']) + ->addElement('text', 'website', ['data-spambots' => 'true', + 'autocomplete' => 'off']) ->addElement('timer', 'timer', ['session' => Zend_Registry::get('session'), 'salt' => __CLASS__, diff --git a/library/ZendAfi/Form/NewsletterRegister.php b/library/ZendAfi/Form/NewsletterRegister.php index 940ff5167f1dcf48475f4b752bb59ae7c174c794..252fd746bd1a595ad14c33bfa1c6aab2925e663f 100644 --- a/library/ZendAfi/Form/NewsletterRegister.php +++ b/library/ZendAfi/Form/NewsletterRegister.php @@ -30,9 +30,9 @@ class ZendAfi_Form_NewsletterRegister extends ZendAfi_Form { 'size' => 75, 'required' => true, 'allowEmpty'=> false]) - ->addElement('text', 'emailCheck', [ - 'data-spambots' => 'negative-captcha', - 'autocomplete' => 'off']) + ->addElement('text', 'website', [ + 'data-spambots' => 'negative-captcha', + 'autocomplete' => 'off']) ->addElement('submit', 'submit', ['label' => $this->_('Valider')]); } } diff --git a/library/ZendAfi/Form/PreRegistration/Koha.php b/library/ZendAfi/Form/PreRegistration/Koha.php index f71d51f075f040bdec8e824b7d4d5e470f869f7f..9ea54b502c32fa671fd17fdb27321cdbd565d057 100644 --- a/library/ZendAfi/Form/PreRegistration/Koha.php +++ b/library/ZendAfi/Form/PreRegistration/Koha.php @@ -77,7 +77,7 @@ class ZendAfi_Form_PreRegistration_Koha extends ZendAfi_Form { 'required' => true]) ->addElement('text', - 'emailCheck', + 'website', ['data-spambots' => 'true', 'autocomplete' => 'off']) @@ -98,7 +98,7 @@ class ZendAfi_Form_PreRegistration_Koha extends ZendAfi_Form { 'address_fieldset', ['legend' => $this->_('Votre adresse')]) - ->addDisplayGroup(['email', 'phone', 'emailCheck'], + ->addDisplayGroup(['email', 'phone', 'website'], 'contact_fieldset', ['legend' => $this->_('Information de contact')]); diff --git a/library/ZendAfi/Form/PreRegistration/Nanook.php b/library/ZendAfi/Form/PreRegistration/Nanook.php index 5f9e2af05757d299bd7261eb52a76c293c276f93..383a5944bac9ae0a582118f508d7273e281d1f91 100644 --- a/library/ZendAfi/Form/PreRegistration/Nanook.php +++ b/library/ZendAfi/Form/PreRegistration/Nanook.php @@ -56,7 +56,7 @@ class ZendAfi_Form_PreRegistration_Nanook extends ZendAfi_Form { 'validators' => [new ZendAfi_Validate_MailEquals('mail')]]) ->addElement('text', - 'emailCheck', + 'website', ['data-spambots' => 'true', 'autocomplete' => 'off' ]) diff --git a/library/ZendAfi/Form/Register.php b/library/ZendAfi/Form/Register.php index 84f4ad8e0c05990982c3495767858ac7464bac26..2c5fd91ac081b891ae63c51b167f60fa9729fe75 100644 --- a/library/ZendAfi/Form/Register.php +++ b/library/ZendAfi/Form/Register.php @@ -62,10 +62,10 @@ class ZendAfi_Form_Register extends ZendAfi_Form { 'allowEmpty' => false, 'validators' => [new ZendAfi_Validate_MailEquals('mail')]]) - ->addElement('text', 'emailCheck', ['data-spambots' => 'true', - 'autocomplete' => 'off']) + ->addElement('text', 'website', ['data-spambots' => 'true', + 'autocomplete' => 'off']) - ->addDisplayGroup(['login', 'mdp', 'mdp2', 'mail', 'mail2', 'emailCheck'], + ->addDisplayGroup(['login', 'mdp', 'mdp2', 'mail', 'mail2', 'website'], 'fields', ['legend' => '']); diff --git a/library/ZendAfi/View/Helper/TagPreRegistration.php b/library/ZendAfi/View/Helper/TagPreRegistration.php index 7fffb1bfaf853adc1ea6bd2e185552e0675fde38..035a9779d4ff97171b0eb968926f97cf914a5c5a 100644 --- a/library/ZendAfi/View/Helper/TagPreRegistration.php +++ b/library/ZendAfi/View/Helper/TagPreRegistration.php @@ -22,6 +22,9 @@ class ZendAfi_View_Helper_TagPreRegistration extends ZendAfi_View_Helper_BaseHelper { public function tagPreRegistration($library, $form, $html = true) { + if (!$library) + return $this->_tag('p', $this->_('Votre demande d\'inscription a bien été enregistrée.')); + $library_label = $library->getLibelle(); $success = $this->_('Votre demande d\'inscription à %s a bien été enregistrée.', ($html ? $this->_tag('b', $library_label) : $library_label)); @@ -32,11 +35,7 @@ class ZendAfi_View_Helper_TagPreRegistration extends ZendAfi_View_Helper_BaseHel : $this->view->tagLibraryAddress($library))); return $html ? ($this->_tag('p', $success) . - $this->_tag('p', $address) . - $this->_tag('div', - $this->_tag('p', $this->_('Récapitulatif des informations')) . - $this->view->renderForm($form->lock()), - ['class' => 'pre-registration-form-wrapper'])) + $this->_tag('p', $address)) : $success . "\n" . $address; } } \ No newline at end of file diff --git a/tests/application/modules/opac/controllers/AuthControllerPreRegistrationTest.php b/tests/application/modules/opac/controllers/AuthControllerPreRegistrationTest.php index 22911db7786dc8d88af1eeb0c3c1d2c25f44187d..fc59cd40346387ec79d53b9537782393912bce89 100644 --- a/tests/application/modules/opac/controllers/AuthControllerPreRegistrationTest.php +++ b/tests/application/modules/opac/controllers/AuthControllerPreRegistrationTest.php @@ -118,8 +118,8 @@ class AuthControllerPreRegistrationKohaDispatchTest extends AuthControllerPreReg /** @test */ - public function inputEmailCheckForSpamBotsShouldBePresent() { - $this->assertXPath('//input[@name="emailCheck"][@data-spambots="true"][@autocomplete="off"]'); + public function inputAntiSpamWebsiteForSpamBotsShouldBePresent() { + $this->assertXPath('//input[@name="website"][@data-spambots="true"][@autocomplete="off"]'); } } @@ -155,13 +155,13 @@ class AuthControllerPreRegistrationKohaPostDispatchTest extends AuthControllerPr 'city' => 'Gotham', 'email' => 'thom@mail.com', 'phone' => '0123456789', - 'emailCheck' => '']); + 'website' => '']); } /** @test */ - public function responseShouldRedirectToPreRegistration() { - $this->assertRedirectTo('http://localhost' . BASE_URL . '/auth/pre-registration-success/branchcode/1%7CGRA/surname/Boulard/firstname/Thom/dateofbirth/15-09-1940/streetnumber/10/address/rue+secret/zipcode/01630/city/Gotham/email/thom%40mail.com/phone/0123456789'); + public function responseShouldRedirectToPreRegistrationIdBibFive() { + $this->assertRedirectTo('http://localhost' . BASE_URL . '/auth/pre-registration-success/id_bib/5'); } @@ -187,7 +187,7 @@ class AuthControllerKohaPreRegistrationSpammedPostDispatchTest extends AuthContr 'address' => 'rue secret', 'zipcode' => '01630', 'email' => 'thom@mail.com', - 'emailCheck' => 'imabot@wcry.ru'], + 'website' => 'imabot@wcry.ru'], true); } @@ -236,8 +236,8 @@ class AuthControllerPreRegistrationKohaPostDispatchWithErrorReturnedTest extends /** @test */ - public function responseShouldRedirectToPreRegistrationError() { - $this->assertRedirectTo('http://localhost' . BASE_URL . '/auth/pre-registration/branchcode/1%7CGRA/surname/Boulard/firstname/Thom/dateofbirth/15%2F09%2F1940/streetnumber/10/address/rue+secret/zipcode/01630/city/Gotham/email/thom%40mail.com/phone/0123456789'); + public function responseShouldRedirectToPreRegistrationErrorIdBibFive() { + $this->assertRedirectTo('http://localhost' . BASE_URL . '/auth/pre-registration/id_bib/5'); } } @@ -248,7 +248,7 @@ class AuthControllerPreRegistrationKohaSuccessDispatchTest extends AuthControlle public function setUp() { parent::setUp(); - $this->dispatch('/auth/pre-registration-success/branchcode/1%7CGRA/surname/Boulard/firstname/Thom/dateofbirth/15-09-1940/address/rue+secret/zipcode/01630/email/thom%40mail.com', true); + $this->dispatch('/auth/pre-registration-success/id_bib/5', true); } @@ -262,12 +262,6 @@ class AuthControllerPreRegistrationKohaSuccessDispatchTest extends AuthControlle public function successMessageShouldContainsGransAddress() { $this->assertXPathContentContains('//div//p', 'Afin de finaliser votre inscription, merci de vous rendre dans votre médiathèque : <b>1 rue proche de la mer 83756 Juan les Pins</b>'); } - - - /** @test */ - public function dateofBirthShouldBeDisbled() { - $this->assertXPath('//form//input[@name="dateofbirth"][@type="text"][@disabled="disabled"][@value="15/09/1940"]'); - } } @@ -334,7 +328,7 @@ class AuthControllerPreRegistrationNanookDispatchTest /** @test */ public function formShouldContainsCaptcha() { - $this->assertXPath('//input[@name="emailCheck"][@data-spambots="true"][@autocomplete="off"]'); + $this->assertXPath('//input[@name="website"][@data-spambots="true"][@autocomplete="off"]'); } } @@ -371,19 +365,13 @@ class AuthControllerPreRegistrationNanookPostDispatchTest 'town' => 'titi', 'zipcode' => '123456', 'address' => '123', - 'emailCheck' => '']); + 'website' => '']); } /** @test */ - public function shouldRedirect() { - $this->assertRedirect(); - } - - - /** @test */ - public function responseShouldRedirectToPreRegistrationSuccess() { - $this->assertRedirectTo('http://localhost' . BASE_URL . '/auth/pre-registration-success/site/1/lastName/Jiro/firstName/Tom/mail/test%40test.fr/mail2/test%40test.fr/password/pwd123456/password2/pwd123456/birthDate/2001-05-05/town/titi/zipcode/123456/address/123'); + public function responseShouldRedirectToPreRegistrationSuccessIdBibOne() { + $this->assertRedirectTo('http://localhost' . BASE_URL . '/auth/pre-registration-success/id_bib/1'); } @@ -439,13 +427,13 @@ class AuthControllerPreRegistrationNanookPostDispatchErrorTest 'town' => 'titi', 'zipcode' => '123456', 'address' => '123', - 'emailCheck' => '']); + 'website' => '']); } /** @test */ - public function responseShouldRedirectToPreRegistrationError() { - $this->assertRedirectTo('http://localhost' . BASE_URL . '/auth/pre-registration/site/1/lastName/Jiro/firstName/Tom/mail/test%40test.fr/mail2/test%40test.fr/password/pwd123456/password2/pwd123456/birthDate/2001-05-05/town/titi/zipcode/123456/address/123'); + public function responseShouldRedirectToPreRegistrationErrorIdBibOne() { + $this->assertRedirectTo('http://localhost' . BASE_URL . '/auth/pre-registration/id_bib/1'); } } @@ -468,7 +456,7 @@ class AuthControllerPreRegistrationNanookPostDispatchSpamTest 'town' => 'titi', 'zipcode' => '123456', 'address' => '123', - 'emailCheck' => 'russian-pal@poutine.ru']); + 'website' => 'russian-pal@poutine.ru']); } @@ -480,6 +468,23 @@ class AuthControllerPreRegistrationNanookPostDispatchSpamTest +class AuthControllerPreRegistrationNanookSuccessDispatchTest extends AuthControllerPreRegistrationNanookTestCase { + /** @test */ + public function withSiteGivenShouldDisplayLibraryName() { + $this->dispatch('/auth/pre-registration-success/id_bib/1', true); + $this->assertXPathContentContains('//div//p', 'Votre demande d\'inscription à <b>Arcadia</b> a bien été enregistrée.', $this->_response->getBody()); + } + + + /** @test */ + public function withoutSiteShouldNotDisplayLibraryName() { + $this->dispatch('/auth/pre-registration-success', true); + $this->assertXPathContentContains('//div//p', 'Votre demande d\'inscription a bien été enregistrée.', $this->_response->getBody()); + } +} + + + class AuthControllerPreRegistrationWithNoPreRegistrationTest extends AuthControllerPreRegistrationNanookTestCase { public function setUp() { diff --git a/tests/application/modules/opac/controllers/AuthControllerTest.php b/tests/application/modules/opac/controllers/AuthControllerTest.php index bdf03fe12b1ab2ca65df95aca65a36c2c06f28ba..4d08c123c7ae72624472c7f15b491609d03f4755 100644 --- a/tests/application/modules/opac/controllers/AuthControllerTest.php +++ b/tests/application/modules/opac/controllers/AuthControllerTest.php @@ -1435,8 +1435,8 @@ class AuthControllerNobodyLoggedAndRegistrationAllowedRegisterTest extends AuthC /** @test */ - public function inputEmailCheckForSpamBotsShouldBePresent() { - $this->assertXPath('//input[@name="emailCheck"][@data-spambots="true"][@autocomplete="off"]'); + public function inputWebsiteForSpamBotsShouldBePresent() { + $this->assertXPath('//input[@name="website"][@data-spambots="true"][@autocomplete="off"]'); } @@ -1570,7 +1570,7 @@ class AuthControllerNobodyLoggedRegisterPostRightDatasTest 'mdp2' => 'secret', 'lastname' => 'bros', 'firstname' => 'mario', - 'emailCheck' => '']); + 'website' => '']); $this->_from = $this->getSentMail()->getFrom(); $this->_recipients = $this->getSentMail()->getRecipients(); @@ -1690,7 +1690,7 @@ class AuthControllerNobodyLoggedRegisterSendBibNotification extends AuthControll 'id_site' => 10, 'lastname' => 'bros', 'firstname' => 'mario', - 'emailCheck' => '']; + 'website' => '']; $this->postDispatch('auth/register', $user); @@ -1840,7 +1840,7 @@ class AuthControllerNobodyLoggedRegisterPostWrongDataTest extends AuthController /** @test */ - public function withEmailCheckNotEmptyShouldRedirectToRoot() { + public function withWebSiteForSpamBotsNotEmptyShouldRedirectToRoot() { $this->postDispatch('auth/register', ['login' => 'mario', 'mail' => 'mario@afi-sa.fr', @@ -1849,7 +1849,7 @@ class AuthControllerNobodyLoggedRegisterPostWrongDataTest extends AuthController 'mdp2' => 'secret', 'lastname' => 'bros', 'firstname' => 'mario', - 'emailCheck' => 'something@somewhere.com']); + 'website' => 'something.somewhere.com']); $this->assertRedirectTo('/'); @@ -2055,7 +2055,7 @@ class AuthControllerNewsletterRegisterKickSpamBotsTest extends AuthControllerNob $this->postDispatch('/opac/auth/newsletter-register/id/5', [ 'email' => 'imnotabot@factory.bot', - 'emailCheck' => 'imnotabot@factory.bot']); + 'website' => 'imnotabot.factory.bot']); } @@ -2100,7 +2100,7 @@ class AuthControllerNobodyLoggedAndRegisterNewsletterTest extends AuthController /** @test */ public function negativeCaptchaShouldBePresent() { - $this->assertXPath('//form//input[@name="emailCheck"][@data-spambots="negative-captcha"][@autocomplete="off"]'); + $this->assertXPath('//form//input[@name="website"][@data-spambots="negative-captcha"][@autocomplete="off"]'); } @@ -2127,7 +2127,7 @@ class AuthControllerPostRegisterNewsletterDailyNewsTest extends AuthControllerNo $this->fixture('Class_Newsletter', ['id' => 5, 'titre' => 'Daily News']); $this->postDispatch('/opac/auth/newsletter-register/id/5', ['email' => 'iwanttobespamed@abo.bzh', - 'emailCheck' => '']); + 'website' => '']); } @@ -2231,7 +2231,7 @@ class AuthControllerPostRegisterNewsletterDailyNewsWithNonUniqueMailTest extends $this->postDispatch('/opac/auth/newsletter-register/id/5', [ 'email' => 'imalreadyused@mail.com', - 'emailCheck' => '']); + 'website' => '']); } @@ -2259,7 +2259,7 @@ class AuthControllerPostRegisterNewsletterDailyNewsWithBadMailTest extends AuthC $this->fixture('Class_Newsletter', ['id' => 5, 'titre' => 'Daily News']); $this->postDispatch('/opac/auth/newsletter-register/id/5', ['email' => 'bad_mail!', - 'emailCheck' => '']); + 'website' => '']); } /** @test */ @@ -2521,7 +2521,7 @@ class AuthControllerNewsletterRegisterSendMailWrongMailConfigurationTest extends $this->fixture('Class_Newsletter', ['id' => 5, 'titre' => 'Daily News']); $this->postDispatch('/opac/auth/newsletter-register/id/5', ['email' => 'iwanttobespamed@abo.it', - 'emailCheck' => '']); + 'website' => '']); } diff --git a/tests/application/modules/opac/controllers/FormulaireContactTest.php b/tests/application/modules/opac/controllers/FormulaireContactTest.php index f83eefe9f8aa9fd48aefe030b2cf38dc89d91265..677bd53a5bdb0a6d0836d7549e0fc79c9180f210 100644 --- a/tests/application/modules/opac/controllers/FormulaireContactTest.php +++ b/tests/application/modules/opac/controllers/FormulaireContactTest.php @@ -113,16 +113,16 @@ class FormulaireContactInvalidEmailHoneyPotPostTest extends AbstractControllerTe /** @test */ - public function formShouldContainsInputEmailCheck() { + public function formShouldContainsInputAntiSpamWebsite() { $this->dispatch('/index/formulairecontact', true); - $this->assertXPath('//input[@name="emailCheck"]'); + $this->assertXPath('//input[@name="website"]'); } /** @test */ public function botShouldBeRedirect() { $this->postDispatch('/opac/index/formulairecontact', - ['emailCheck' => 'email@email.com']); + ['website' => 'email@email.com']); $this->assertRedirectTo('/'); } } diff --git a/tests/application/modules/opac/controllers/FormulaireControllerTest.php b/tests/application/modules/opac/controllers/FormulaireControllerTest.php index bbc693973b9fe20c33473161a0050a2ddeb6f8b0..b75feb28b7f122e745cc4e67b499f45bdcaa0843 100644 --- a/tests/application/modules/opac/controllers/FormulaireControllerTest.php +++ b/tests/application/modules/opac/controllers/FormulaireControllerTest.php @@ -122,7 +122,7 @@ class FormulaireControllerPostActionTest extends FormulaireControllerPostActionT $this->postDispatch('/formulaire/add/id_article/45', ['nom' => 'Tinguette' , 'prenom' => 'Quentin', - 'emailCheck' => ''], + 'website' => ''], true); $this->new_formulaire = Class_Formulaire::find(2); @@ -213,7 +213,7 @@ class FormulaireControllerPostAsBotTest extends FormulaireControllerPostActionTe $this->postDispatch('/formulaire/add/id_article/45', ['nom' => 'Tinguette' , 'prenom' => 'Quentin', - 'emailCheck' => 'i am a bot'], + 'website' => 'i am a bot'], true); $this->new_formulaire = Class_Formulaire::find(2); diff --git a/tests/library/Class/ArticleFormulaireTest.php b/tests/library/Class/ArticleFormulaireTest.php index 3e60e60cea97029acfc8d37d82da6378d868e151..076cc3abe7c05c2bf35db0420f45fc8b18ad13d3 100644 --- a/tests/library/Class/ArticleFormulaireTest.php +++ b/tests/library/Class/ArticleFormulaireTest.php @@ -40,7 +40,7 @@ class ArticleFormulaireInternalTest extends ViewHelperTestCase { POST<form method="POST" id="without_action"> <input type="button" value="likebutton" /> - <input data-spambots="true" autocomplete="off" name="emailCheck" type="text" /> + <input data-spambots="true" autocomplete="off" name="websiteCheck" type="text" /> </form> EMPTY<form id="empty"> </form> @@ -59,10 +59,10 @@ class ArticleFormulaireInternalTest extends ViewHelperTestCase { /** @test */ - public function eachFormShouldContainsInputEmailCheckForSpamBot() { + public function eachFormShouldContainsInputWebsiteCheckForSpamBot() { $this ->assertXPathCount($this->_content, - '//form/input[@name="emailCheck"][@data-spambots="true"][@autocomplete="off"]', + '//form/input[@name="websiteCheck"][@data-spambots="true"][@autocomplete="off"]', 3); } @@ -125,7 +125,7 @@ class ArticleFormulaireInternalTest extends ViewHelperTestCase { -class ArticleFormulaireWithLegacyEmailCheckTest extends ModelTestCase { +class ArticleFormulaireWithLegacyWebsiteCheckTest extends ModelTestCase { protected $_storm_default_to_volatile = true; public function setUp() { @@ -136,7 +136,7 @@ class ArticleFormulaireWithLegacyEmailCheckTest extends ModelTestCase { 'contenu' => ' <form id="old" > <input name="extenvoi" value="extenvoi" type="submit"/> - <input name="emailCheck" /> + <input name="websiteCheck" /> </form> ']); } @@ -182,7 +182,7 @@ class ArticleFormulaireExternalTest extends ModelTestCase { /** @test */ - public function inputEmailCheckShouldNotBePresent() { - $this->assertNotContains('emailCheck', $this->_article->getContenu()); + public function inputWebsiteCheckShouldNotBePresent() { + $this->assertNotContains('websiteCheck', $this->_article->getContenu()); } }