Skip to content

Commit ca30c6a

Browse files
committed
Use same default sort as github api does
1 parent 5a55b02 commit ca30c6a

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

lib/Github/Api/Issue/Milestones.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ public function all($username, $repository, array $params = array())
3030
$params['sort'] = 'due_date';
3131
}
3232
if (isset($params['direction']) && !in_array($params['direction'], array('asc', 'desc'))) {
33-
$params['direction'] = 'desc';
33+
$params['direction'] = 'asc';
3434
}
3535

3636
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones', array_merge(array(
3737
'page' => 1,
3838
'state' => 'open',
3939
'sort' => 'due_date',
40-
'direction' => 'desc'
40+
'direction' => 'asc'
4141
), $params));
4242
}
4343

test/Github/Tests/Api/Issue/MilestonesTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function shouldGetMilestones()
1616
$api = $this->getApiMock();
1717
$api->expects($this->once())
1818
->method('get')
19-
->with('/repos/KnpLabs/php-github-api/milestones', array('page' => 1, 'state' => 'open', 'sort' => 'due_date', 'direction' => 'desc'))
19+
->with('/repos/KnpLabs/php-github-api/milestones', array('page' => 1, 'state' => 'open', 'sort' => 'due_date', 'direction' => 'asc'))
2020
->will($this->returnValue($expectedValue));
2121

2222
$this->assertEquals($expectedValue, $api->all('KnpLabs', 'php-github-api'));
@@ -132,7 +132,7 @@ public function shouldSortByDueDateWhenSortParamNotRecognized()
132132
$api = $this->getApiMock();
133133
$api->expects($this->once())
134134
->method('get')
135-
->with('/repos/KnpLabs/php-github-api/milestones', array('page' => 1, 'state' => 'open', 'sort' => 'due_date', 'direction' => 'desc'))
135+
->with('/repos/KnpLabs/php-github-api/milestones', array('page' => 1, 'state' => 'open', 'sort' => 'due_date', 'direction' => 'asc'))
136136
->will($this->returnValue($expectedValue));
137137

138138
$this->assertEquals($expectedValue, $api->all('KnpLabs', 'php-github-api', array('sort' => 'completenes')));
@@ -148,7 +148,7 @@ public function shouldSetStateToOpenWhenStateParamNotRecognized()
148148
$api = $this->getApiMock();
149149
$api->expects($this->once())
150150
->method('get')
151-
->with('/repos/KnpLabs/php-github-api/milestones', array('page' => 1, 'state' => 'open', 'sort' => 'due_date', 'direction' => 'desc'))
151+
->with('/repos/KnpLabs/php-github-api/milestones', array('page' => 1, 'state' => 'open', 'sort' => 'due_date', 'direction' => 'asc'))
152152
->will($this->returnValue($expectedValue));
153153

154154
$this->assertEquals($expectedValue, $api->all('KnpLabs', 'php-github-api', array('state' => 'clos')));
@@ -164,10 +164,10 @@ public function shouldSetDirectionToDescWhenDirectionParamNotRecognized()
164164
$api = $this->getApiMock();
165165
$api->expects($this->once())
166166
->method('get')
167-
->with('/repos/KnpLabs/php-github-api/milestones', array('page' => 1, 'state' => 'open', 'sort' => 'due_date', 'direction' => 'desc'))
167+
->with('/repos/KnpLabs/php-github-api/milestones', array('page' => 1, 'state' => 'open', 'sort' => 'due_date', 'direction' => 'asc'))
168168
->will($this->returnValue($expectedValue));
169169

170-
$this->assertEquals($expectedValue, $api->all('KnpLabs', 'php-github-api', array('direction' => 'des')));
170+
$this->assertEquals($expectedValue, $api->all('KnpLabs', 'php-github-api', array('direction' => 'asc')));
171171
}
172172

173173
/**

0 commit comments

Comments
 (0)