From a07c9f0c3c475503841aef2744ed0ae42ebe5189 Mon Sep 17 00:00:00 2001 From: euromark Date: Tue, 5 Mar 2013 22:11:23 +0100 Subject: [PATCH] Fix FormHelper year range for ranges outside of 1901-2038 --- .../Test/Case/View/Helper/FormHelperTest.php | 67 +++++++++++++++++++ lib/Cake/View/Helper/FormHelper.php | 15 +++-- 2 files changed, 75 insertions(+), 7 deletions(-) diff --git a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php index 014cfba79..4b869b073 100644 --- a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php @@ -5845,6 +5845,23 @@ class FormHelperTest extends CakeTestCase { '*/select', ); $this->assertTags($result, $expected); + + $this->Form->request->data['Project']['release'] = '2050-02-10'; + $result = $this->Form->month('Project.release'); + + $expected = array( + array('select' => array('name' => 'data[Project][release][month]', 'id' => 'ProjectReleaseMonth')), + array('option' => array('value' => '')), + '/option', + array('option' => array('value' => '01')), + 'January', + '/option', + array('option' => array('value' => '02', 'selected' => 'selected')), + 'February', + '/option', + '*/select', + ); + $this->assertTags($result, $expected); } /** @@ -5933,6 +5950,28 @@ class FormHelperTest extends CakeTestCase { '/select', ); $this->assertTags($result, $expected); + + $this->Form->request->data['Project']['release'] = '2050-10-10'; + $result = $this->Form->day('Project.release'); + + $expected = array( + array('select' => array('name' => 'data[Project][release][day]', 'id' => 'ProjectReleaseDay')), + array('option' => array('value' => '')), + '/option', + array('option' => array('value' => '01')), + '1', + '/option', + array('option' => array('value' => '02')), + '2', + '/option', + $daysRegex, + array('option' => array('value' => '10', 'selected' => 'selected')), + '10', + '/option', + $daysRegex, + '/select', + ); + $this->assertTags($result, $expected); } /** @@ -6103,6 +6142,26 @@ class FormHelperTest extends CakeTestCase { $thisHour = date('H'); $optValue = date('G'); $this->assertRegExp('/