Permalink
Browse files

Merge branch '1.3' of git://github.com/cakephp/cakephp into 1.3

  • Loading branch information...
2 parents c918395 + f65cf55 commit 5c18571db1b4186ddbfdff138f8eebbb6c887b52 @ceeram ceeram committed May 12, 2011
Showing with 19 additions and 5 deletions.
  1. +1 −2 cake/libs/view/helpers/form.php
  2. +18 −3 cake/tests/cases/libs/view/helpers/form.test.php
@@ -1832,9 +1832,8 @@ function dateTime($fieldName, $dateFormat = 'DMY', $timeFormat = '12', $selected
if (!empty($timeFormat)) {
$time = explode(':', $days[1]);
- $check = str_replace(':', '', $days[1]);
- if (($check > 115959) && $timeFormat == '12') {
+ if (($time[0] > 12) && $timeFormat == '12') {
$time[0] = $time[0] - 12;
$meridian = 'pm';
} elseif ($time[0] == '00' && $timeFormat == '12') {
@@ -1887,11 +1887,10 @@ function testInputCheckbox() {
}
/**
- * test form->input() with datetime, date and time types
+ * test form->input() with time types.
*
- * @return void
*/
- function testInputDatetime() {
+ function testInputTime() {
extract($this->dateRegex);
$result = $this->Form->input('Contact.created', array('type' => 'time', 'timeFormat' => 24));
$result = explode(':', $result);
@@ -1929,6 +1928,22 @@ function testInputDatetime() {
$this->assertPattern('#<option value="15"[^>]*>15</option>#', $result[1]);
$this->assertPattern('#<option value="30"[^>]*>30</option>#', $result[1]);
+ $result = $this->Form->input('Random.start_time', array(
+ 'type' => 'time',
+ 'selected' => '18:15'
+ ));
+ $this->assertPattern('#<option value="06"[^>]*>6</option>#', $result);
+ $this->assertPattern('#<option value="15"[^>]*>15</option>#', $result);
+ $this->assertPattern('#<option value="pm"[^>]*>pm</option>#', $result);
+ }
+
+/**
+ * test form->input() with datetime, date and time types
+ *
+ * @return void
+ */
+ function testInputDatetime() {
+ extract($this->dateRegex);
$result = $this->Form->input('prueba', array(
'type' => 'datetime', 'timeFormat'=> 24 , 'dateFormat'=>'DMY' , 'minYear' => 2008,
'maxYear' => date('Y') + 1 ,'interval' => 15

0 comments on commit 5c18571

Please sign in to comment.