mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
minute function + tests
This commit is contained in:
parent
5f0700342b
commit
d3c1e8c974
2 changed files with 8 additions and 7 deletions
|
@ -1651,14 +1651,13 @@ class FormHelper extends AppHelper {
|
|||
* that string is displayed as the empty element.
|
||||
*
|
||||
* @param string $fieldName Prefix name for the SELECT element
|
||||
* @param string $selected Option which is selected.
|
||||
* @param string $attributes Array of Attributes
|
||||
* @return string Completed minute select input.
|
||||
* @access public
|
||||
* @link http://book.cakephp.org/view/1421/minute
|
||||
*/
|
||||
public function minute($fieldName, $selected = null, $attributes = array()) {
|
||||
$attributes += array('empty' => true, 'value' => $selected);
|
||||
public function minute($fieldName, $attributes = array()) {
|
||||
$attributes += array('empty' => true, 'value' => null);
|
||||
$attributes = $this->__dateTimeSelected('min', $fieldName, $attributes);
|
||||
|
||||
if (strlen($attributes['value']) > 2) {
|
||||
|
@ -1902,13 +1901,15 @@ class FormHelper extends AppHelper {
|
|||
switch ($timeFormat) {
|
||||
case '24':
|
||||
$selectHourAttr['value'] = $hour;
|
||||
$selectMinuteAttr['value'] = $min;
|
||||
$opt .= $this->hour($fieldName, true, $selectHourAttr) . ':' .
|
||||
$this->minute($fieldName, $min, $selectMinuteAttr);
|
||||
$this->minute($fieldName, $selectMinuteAttr);
|
||||
break;
|
||||
case '12':
|
||||
$selectHourAttr['value'] = $hour;
|
||||
$selectMinuteAttr['value'] = $min;
|
||||
$opt .= $this->hour($fieldName, false, $selectHourAttr) . ':' .
|
||||
$this->minute($fieldName, $min, $selectMinuteAttr) . ' ' .
|
||||
$this->minute($fieldName, $selectMinuteAttr) . ' ' .
|
||||
$this->meridian($fieldName, $meridian, $selectMeridianAttr);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -4691,7 +4691,7 @@ class FormHelperTest extends CakeTestCase {
|
|||
$this->assertTags($result, $expected);
|
||||
|
||||
$this->Form->request->data['Model']['field'] = '';
|
||||
$result = $this->Form->minute('Model.field', null, array('interval' => 5));
|
||||
$result = $this->Form->minute('Model.field', array('interval' => 5));
|
||||
$expected = array(
|
||||
array('select' => array('name' => 'data[Model][field][min]', 'id' => 'ModelFieldMin')),
|
||||
array('option' => array('value' => '')),
|
||||
|
@ -4711,7 +4711,7 @@ class FormHelperTest extends CakeTestCase {
|
|||
$this->assertTags($result, $expected);
|
||||
|
||||
$this->Form->request->data['Model']['field'] = '2006-10-10 00:10:32';
|
||||
$result = $this->Form->minute('Model.field', null, array('interval' => 5));
|
||||
$result = $this->Form->minute('Model.field', array('interval' => 5));
|
||||
$expected = array(
|
||||
array('select' => array('name' => 'data[Model][field][min]', 'id' => 'ModelFieldMin')),
|
||||
array('option' => array('value' => '')),
|
||||
|
|
Loading…
Reference in a new issue