Adding test to disprove Ticket #3506 (DboSource::order())

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6010 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
nate 2007-11-17 03:57:15 +00:00
parent a83cfa8489
commit 3c7d0e90ee

View file

@ -2051,6 +2051,22 @@ class DboSourceTest extends CakeTestCase {
$result = $this->db->order("Page.name = 'view' DESC");
$this->assertPattern("/^\s*ORDER BY\s+`Page`\.`name`\s*=\s*'view'\s+DESC\s*$/", $result);
$result = $this->db->order("(Post.views)");
$this->assertPattern("/^\s*ORDER BY\s+\(`Post`\.`views`\)\s+ASC\s*$/", $result);
$result = $this->db->order("(Post.views)*Post.views");
$this->assertPattern("/^\s*ORDER BY\s+\(`Post`\.`views`\)\*`Post`\.`views`\s+ASC\s*$/", $result);
$result = $this->db->order("(Post.views) * Post.views");
$this->assertPattern("/^\s*ORDER BY\s+\(`Post`\.`views`\) \* `Post`\.`views`\s+ASC\s*$/", $result);
$result = $this->db->order("(Model.field1 + Model.field2) * Model.field3");
$this->assertPattern("/^\s*ORDER BY\s+\(`Model`\.`field1` \+ `Model`\.`field2`\) \* `Model`\.`field3`\s+ASC\s*$/", $result);
$result = $this->db->order("Model.name+0 ASC");
$this->assertPattern("/^\s*ORDER BY\s+`Model`\.`name`\+0\s+ASC\s*$/", $result);
}
}
?>