Skip to content

Commit

Permalink
Testing the important things and not specific behavior of the
Browse files Browse the repository at this point in the history
database servers
  • Loading branch information
lorenzo committed Mar 8, 2015
1 parent 22e377f commit 8545b87
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions tests/TestCase/Database/QueryTest.php
Expand Up @@ -1477,14 +1477,15 @@ public function testSelectDistinctON()
->select(['id', 'author_id'])
->distinct(['author_id'])
->from(['a' => 'articles'])
->order(['id' => 'DESC'])
->order(['id' => 'ASC'])
->execute();
$this->assertCount(2, $result);
$expected = [
['id' => 3, 'author_id' => 1],
['id' => 2, 'author_id' => 3],
];
$this->assertEquals($expected, $result->fetchAll('assoc'));
$results = $result->fetchAll('assoc');
$this->assertEquals(['id', 'author_id'], array_keys($results[0]));
$this->assertEquals(
[3, 1],
collection($results)->sortBy('author_id')->extract('author_id')->toList()
);
}

/**
Expand Down

0 comments on commit 8545b87

Please sign in to comment.