Adding patch from ticket #2324 plus test

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4731 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
dho 2007-04-01 14:31:23 +00:00
parent 3af3f242f6
commit d4c5eea261
2 changed files with 9 additions and 1 deletions

View file

@ -693,7 +693,7 @@ class FormHelper extends AppHelper {
if (empty($selected) && !$showEmpty) {
$selected = date('Y');
}
return $this->select($fieldName . "_year", $this->__generateOptions('year'), $selected, $attributes, $showEmpty);
return $this->select($fieldName . "_year", $this->__generateOptions('year', $minYear, $maxYear), $selected, $attributes, $showEmpty);
}
/**
* Returns a SELECT element for months.

View file

@ -223,6 +223,14 @@ class FormHelperTest extends UnitTestCase {
}
function testYear() {
$result = $this->Form->year('Model.field', 2006, 2007);
$this->assertPattern('/option value="2006"/', $result);
$this->assertPattern('/option value="2007"/', $result);
$this->assertNoPattern('/option value="2005"/', $result);
$this->assertNoPattern('/option value="2008"/', $result);
}
function testTextArea() {
$this->Form->data = array('Model' => array('field' => 'some test data'));
$result = $this->Form->textarea('Model/field');