From 2d3c792997f0b2bab0724c4b4dc386d2be2bf45c Mon Sep 17 00:00:00 2001
From: gloas <gloas@afi-sa.fr>
Date: Mon, 15 May 2017 11:25:18 +0200
Subject: [PATCH] dev #40650 fix tests failures

---
 library/ZendAfi/View/Helper/DatePicker.php            | 11 +++++------
 .../controllers/AuthControllerPreRegistrationTest.php |  4 ++--
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/library/ZendAfi/View/Helper/DatePicker.php b/library/ZendAfi/View/Helper/DatePicker.php
index 7e9cb03211c..bf4121073fd 100644
--- a/library/ZendAfi/View/Helper/DatePicker.php
+++ b/library/ZendAfi/View/Helper/DatePicker.php
@@ -26,9 +26,10 @@ class ZendAfi_View_Helper_DatePicker extends ZendAfi_View_Helper_BaseHelper {
    * @param $maxYear maximum year to display
    * @return html for the date picker
    */
-  public function datePicker($name, $varDate, $dateOnly=true, $allDaySwitch='',$disabled=false, $date_format = 'dd/MM/YYYY') {
+  public function datePicker($name, $varDate, $dateOnly=true, $allDaySwitch='',$disabled=false) {
     $locale = Zend_Registry::get('locale');
-    $optionsdateonly = $optionswithhours = ['dateFormat' => $date_format,
+
+    $optionsdateonly = $optionswithhours = ['dateFormat' => 'dd/MM/YYYY',
                                             'locale' => substr($locale,0,2),
                                             'firstDayOfWeek' => 1,
                                             'minuteInterval' => 15,
@@ -36,7 +37,7 @@ class ZendAfi_View_Helper_DatePicker extends ZendAfi_View_Helper_BaseHelper {
                                             'autodateOnStart' => false,
                                             'dateOnly' => true];
 
-    $optionswithhours['dateFormat'] = $date_format.' hh:mm';
+    $optionswithhours['dateFormat'] = 'dd/MM/YYYY hh:mm';
     $optionswithhours['dateOnly'] = false;
     $optionswithhours['minuteInterval'] = 15;
 
@@ -77,12 +78,10 @@ $("#' . $allDaySwitch . '").click(function() {
     }
 
     $option=[];
-
     if ($disabled)
       $option=['disabled' => 'disabled'];
-
     return $this->view->formText($name,
-                                 $this->formatDate($varDate, $options['dateFormat']),
+                                 $this->formatDate($varDate, 'dd/MM/yyyy'. ($dateOnly ? '' : ' HH:mm')),
                                  array_merge (['id' => $name,
                                   'maxlength' => $dateOnly ? 10 : 16
                                                ],$option));
diff --git a/tests/application/modules/opac/controllers/AuthControllerPreRegistrationTest.php b/tests/application/modules/opac/controllers/AuthControllerPreRegistrationTest.php
index e7784b58992..0cfbf2a1e10 100644
--- a/tests/application/modules/opac/controllers/AuthControllerPreRegistrationTest.php
+++ b/tests/application/modules/opac/controllers/AuthControllerPreRegistrationTest.php
@@ -117,7 +117,7 @@ class AuthControllerPreRegistrationKohaPostDispatchTest extends AuthControllerPr
              ['data' => json_encode(['branchcode' => 'GRA',
                                      'surname' => 'Boulard',
                                      'firstname' => 'Thom',
-                                     'dateofbirth' => '15/09/1940',
+                                     'dateofbirth' => '15-09-1940',
                                      'address' => 'rue secret',
                                      'zipcode' => '01630',
                                      'email' => 'thom@mail.com'])])
@@ -160,7 +160,7 @@ class AuthControllerPreRegistrationKohaPostDispatchWithErrorReturnedTest extends
              ['data' => json_encode(['branchcode' => 'GRA',
                                      'surname' => 'Boulard',
                                      'firstname' => 'Thom',
-                                     'dateofbirth' => '15/09/1940',
+                                     'dateofbirth' => '15-09-1940',
                                      'address' => 'rue secret',
                                      'zipcode' => '01630',
                                      'email' => 'thom@mail.com'])])
-- 
GitLab