Skip to content

Commit

Permalink
Merge branch 'master' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
jails committed Jul 19, 2013
2 parents 467e0b9 + 20ff5b1 commit c7416ab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion data/source/Database.php
Expand Up @@ -1243,7 +1243,7 @@ protected function _sort($field, $context, $clause = 'ORDER BY', $direction = tr
$field = array($field => $direction);
}

if (!is_array($field)) {
if (!is_array($field) || empty($field)) {
return;
}
$result = array();
Expand Down
4 changes: 4 additions & 0 deletions tests/cases/data/source/DatabaseTest.php
Expand Up @@ -607,6 +607,10 @@ public function testOrder() {
$result = $this->_db->order(array('author_id', "title" => "DESC"), $query);
$expected = 'ORDER BY {MockDatabasePost}.{author_id} ASC, {MockDatabasePost}.{title} DESC';
$this->assertEqual($expected, $result);

$result = $this->_db->order(array(), $query);
$expected = '';
$this->assertEqual($expected, $result);
}

public function testOrderOnRelated() {
Expand Down

0 comments on commit c7416ab

Please sign in to comment.