"Fixing use of array('minuteInterval' => #);

Proper usage is array('interval' => #); but for backwards compatibility this fix has been added"

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6633 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2008-04-04 12:48:13 +00:00
parent 1d9a096376
commit a138ae3d63
2 changed files with 7 additions and 1 deletions

View file

@ -1347,7 +1347,7 @@ class FormHelper extends AppHelper {
$elements = array('Day','Month','Year','Hour','Minute','Meridian'); $elements = array('Day','Month','Year','Hour','Minute','Meridian');
$attributes = array_merge(array('minYear' => null, 'maxYear' => null, 'separator' => '-'), (array)$attributes); $attributes = array_merge(array('minYear' => null, 'maxYear' => null, 'separator' => '-'), (array)$attributes);
if (isset($attributes['minuteInterval'])) { if (isset($attributes['minuteInterval'])) {
$selectMinuteAttr['interval'] = $attributes['minuteInterval']; $attributes['interval'] = $attributes['minuteInterval'];
} else { } else {
$selectMinuteAttr['interval'] = 1; $selectMinuteAttr['interval'] = 1;
} }

View file

@ -1170,6 +1170,12 @@ class FormHelperTest extends CakeTestCase {
$this->assertNoPattern('/option value="59"/', $result); $this->assertNoPattern('/option value="59"/', $result);
$this->assertNoPattern('/<option[^<>]+selected="selected"[^>]*>/', $result); $this->assertNoPattern('/<option[^<>]+selected="selected"[^>]*>/', $result);
$result = $this->Form->dateTime('Contact.date', 'DMY', '12', '', array('minuteInterval' => 5));
$this->assertPattern('/<option\s+value=""[^>]*>/', $result);
$this->assertPattern('/option value="55"/', $result);
$this->assertNoPattern('/option value="59"/', $result);
$this->assertNoPattern('/<option[^<>]+selected="selected"[^>]*>/', $result);
$this->Form->data['Contact']['data'] = null; $this->Form->data['Contact']['data'] = null;
$result = $this->Form->dateTime('Contact.date', 'DMY', '12'); $result = $this->Form->dateTime('Contact.date', 'DMY', '12');
$this->assertPattern('/<option\s+value=""[^>]*>/', $result); $this->assertPattern('/<option\s+value=""[^>]*>/', $result);