Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

fix ordering in tests #1104

Merged
merged 1 commit into from

2 participants

@ceeram
Collaborator

No description provided.

@lorenzo lorenzo merged commit 4ae7e12 into cakephp:3.0-database
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 31, 2013
  1. @ceeram

    fix ordering in tests

    ceeram authored
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 5 deletions.
  1. +5 −5 lib/Cake/Test/TestCase/Model/Datasource/Database/QueryTest.php
View
10 lib/Cake/Test/TestCase/Model/Datasource/Database/QueryTest.php
@@ -1,6 +1,6 @@
<?php
/**
- *
+ *
* PHP Version 5.4
*
* CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
@@ -137,14 +137,14 @@ public function testSelectFieldsFromTable() {
$this->assertEquals(array('body' => 'another body', 'author_id' => 2), $result->fetch('assoc'));
//Append more tables to next execution
- $result = $query->select('name')->from(array('authors'))->order(['name' => 'desc'])->execute();
+ $result = $query->select('name')->from(array('authors'))->order(['name' => 'desc', 'articles.id' => 'asc'])->execute();
$this->assertEquals(array('body' => 'a body', 'author_id' => 1, 'name' => 'Chuck Norris'), $result->fetch('assoc'));
$this->assertEquals(array('body' => 'another body', 'author_id' => 2, 'name' => 'Chuck Norris'), $result->fetch('assoc'));
$this->assertEquals(array('body' => 'a body', 'author_id' => 1, 'name' => 'Bruce Lee'), $result->fetch('assoc'));
$this->assertEquals(array('body' => 'another body', 'author_id' => 2, 'name' => 'Bruce Lee'), $result->fetch('assoc'));
//Overwrite tables and only fetch from authors
- $result = $query->select('name', true)->from('authors', true)->execute();
+ $result = $query->select('name', true)->from('authors', true)->order(['name' => 'desc'], true)->execute();
$this->assertEquals(array('Chuck Norris'), $result->fetch());
$this->assertEquals(array('Bruce Lee'), $result->fetch());
$this->assertCount(2, $result);
@@ -196,7 +196,7 @@ public function testSelectAliasedTables() {
$this->assertEquals(['text' => 'another body', 'author_id' => 2], $result->fetch('assoc'));
$result = $query->select(['name' => 'b.name'])->from(['b' => 'authors'])
- ->order(['text' => 'desc'])
+ ->order(['text' => 'desc', 'name' => 'desc'])
->execute();
$this->assertEquals(
['text' => 'another body', 'author_id' => 2, 'name' => 'Chuck Norris'],
@@ -907,7 +907,7 @@ public function testSelectExpressionComposition() {
->from('dates')
->where(function($exp) {
$and = $exp->and_(function($and) {
- return $and->eq('id', 1)->gt('id', 0);
+ return $and->eq('id', 1)->gt('id', 0);
});
return $exp->add($and);
})
Something went wrong with that request. Please try again.