Skip to content

Commit

Permalink
Fix ordering. I got desc/asc backwards like I often do.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Feb 25, 2014
1 parent 71e2308 commit e36e5de
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/View/Widget/DateTime.php
Expand Up @@ -277,7 +277,7 @@ protected function _yearSelect($options = []) {
if (empty($options['options'])) {
$options['options'] = $this->_generateNumbers($options['start'], $options['end']);
}
if ($options['order'] === 'asc') {
if ($options['order'] === 'desc') {
$options['options'] = array_reverse($options['options'], true);
}
unset($options['start'], $options['end'], $options['order']);
Expand Down
20 changes: 10 additions & 10 deletions tests/TestCase/View/Widget/DateTimeTest.php
Expand Up @@ -221,7 +221,7 @@ public function testRenderYearWidgetOrdering() {
'start' => 2013,
'end' => 2015,
'data-foo' => 'test',
'order' => 'desc',
'order' => 'asc',
],
'month' => false,
'day' => false,
Expand All @@ -245,7 +245,7 @@ public function testRenderYearWidgetOrdering() {
'year' => [
'start' => 2013,
'end' => 2015,
'order' => 'asc'
'order' => 'desc'
],
'month' => false,
'day' => false,
Expand Down Expand Up @@ -287,12 +287,12 @@ public function testRenderYearWidgetValueOutOfBounds() {
]);
$expected = [
'select' => ['name' => 'date[year]'],
['option' => ['value' => '2010', 'selected' => 'selected']], '2010', '/option',
['option' => ['value' => '2011']], '2011', '/option',
['option' => ['value' => '2012']], '2012', '/option',
['option' => ['value' => '2013']], '2013', '/option',
['option' => ['value' => '2014']], '2014', '/option',
['option' => ['value' => '2015']], '2015', '/option',
['option' => ['value' => '2014']], '2014', '/option',
['option' => ['value' => '2013']], '2013', '/option',
['option' => ['value' => '2012']], '2012', '/option',
['option' => ['value' => '2011']], '2011', '/option',
['option' => ['value' => '2010', 'selected' => 'selected']], '2010', '/option',
'/select',
];
$this->assertTags($result, $expected);
Expand All @@ -313,10 +313,10 @@ public function testRenderYearWidgetValueOutOfBounds() {
]);
$expected = [
'select' => ['name' => 'date[year]'],
['option' => ['value' => '2010']], '2010', '/option',
['option' => ['value' => '2011']], '2011', '/option',
['option' => ['value' => '2012']], '2012', '/option',
['option' => ['value' => '2013', 'selected' => 'selected']], '2013', '/option',
['option' => ['value' => '2012']], '2012', '/option',
['option' => ['value' => '2011']], '2011', '/option',
['option' => ['value' => '2010']], '2010', '/option',
'/select',
];
$this->assertTags($result, $expected);
Expand Down

0 comments on commit e36e5de

Please sign in to comment.