Merge branch 'master' into 2.4

This commit is contained in:
mark_story 2013-03-13 21:01:03 -04:00
commit 0900c32c03
2 changed files with 12 additions and 4 deletions

View file

@ -2210,6 +2210,15 @@ class FormHelperTest extends CakeTestCase {
$this->assertContains('<option value="06" selected="selected">6</option>', $result);
$this->assertContains('<option value="15" selected="selected">15</option>', $result);
$this->assertContains('<option value="pm" selected="selected">pm</option>', $result);
$result = $this->Form->input('published', array('type' => 'time'));
$now = strtotime('now');
$this->assertContains('<option value="' . date('h', $now) . '" selected="selected">' . date('g', $now) . '</option>', $result);
$now = strtotime('2013-03-09 00:42:21');
$result = $this->Form->input('published', array('type' => 'time', 'selected' => $now));
$this->assertContains('<option value="12" selected="selected">12</option>', $result);
$this->assertContains('<option value="42" selected="selected">42</option>', $result);
}
/**
@ -5571,10 +5580,6 @@ class FormHelperTest extends CakeTestCase {
$this->assertRegExp('/<option[^<>]+value="03"[^<>]+selected="selected"[^>]*>3<\/option>/', $result);
$this->assertRegExp('/<option[^<>]+value="13"[^<>]+selected="selected"[^>]*>13<\/option>/', $result);
$this->assertRegExp('/<option[^<>]+value="35"[^<>]+selected="selected"[^>]*>35<\/option>/', $result);
$result = $this->Form->input('published', array('type' => 'time'));
$now = strtotime('now');
$this->assertContains('<option value="' . date('h', $now) . '" selected="selected">' . date('g', $now) . '</option>', $result);
}
/**

View file

@ -2208,6 +2208,9 @@ class FormHelper extends AppHelper {
if ($attributes['value'] > 12 && !$format24Hours) {
$attributes['value'] -= 12;
}
if ($attributes['value'] === '00' && !$format24Hours) {
$attributes['value'] = 12;
}
return $this->select(
$fieldName . ".hour",