Skip to content

Commit

Permalink
Fixing formHelper::hour when specifying a strtotime compatible string…
Browse files Browse the repository at this point in the history
… for the selected value. Tests added Fixes #5941

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7967 3807eeeb-6ff5-0310-8944-8be069107fe0
  • Loading branch information
markstory committed Dec 30, 2008
1 parent 94b9bca commit 79c7915
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cake/libs/view/helpers/form.php
Expand Up @@ -1364,6 +1364,8 @@ function hour($fieldName, $format24Hours = false, $selected = null, $attributes
$selected = $value;
}
}
} else {
$value = $selected;
}

if (strlen($selected) > 2) {
Expand Down
5 changes: 5 additions & 0 deletions cake/tests/cases/libs/view/helpers/form.test.php
Expand Up @@ -3997,6 +3997,11 @@ function testHour() {
'/select',
);
$this->assertTags($result, $expected);

unset($this->Form->data['Model']['field']);
$result = $this->Form->hour('Model.field', true, 'now');
$thisHour = date('H');
$this->assertPattern('/<option value="' . $thisHour . '" selected="selected">'. $thisHour .'<\/option>/', $result);
}
/**
* testYear method
Expand Down

0 comments on commit 79c7915

Please sign in to comment.