From 98e645a1eab4c1ae8a4ddf346b20aaba4c3842f5 Mon Sep 17 00:00:00 2001 From: Rachman Chavik Date: Sun, 8 Dec 2013 16:39:56 +0700 Subject: [PATCH] Add test to prove issues with deleteAll with $order set --- lib/Cake/Test/Case/Model/ModelDeleteTest.php | 27 ++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/lib/Cake/Test/Case/Model/ModelDeleteTest.php b/lib/Cake/Test/Case/Model/ModelDeleteTest.php index 9abcb5101..dc8f3107a 100644 --- a/lib/Cake/Test/Case/Model/ModelDeleteTest.php +++ b/lib/Cake/Test/Case/Model/ModelDeleteTest.php @@ -491,6 +491,33 @@ class ModelDeleteTest extends BaseModelTest { $this->assertTrue($result); } +/** + * testDeleteAllWithOrderProperty + * + * Ensure find done in deleteAll works with models that has $order property set + * + * @return void + */ + public function testDeleteAllWithOrderProperty() { + $this->loadFixtures('Article', 'User'); + + $TestModel = new Article(); + $TestModel->order = 'Article.published desc'; + $TestModel->unbindModel(array( + 'belongsTo' => array('User'), + 'hasMany' => array('Comment'), + 'hasAndBelongsToMany' => array('Tag') + ), false); + + $result = $TestModel->deleteAll( + array('Article.user_id' => array(1, 3)), + true, + true + ); + + $this->assertTrue($result); + } + /** * testRecursiveDel method *