From a94c8907342c89b3a0fc2d81771175ea475493ba Mon Sep 17 00:00:00 2001 From: "mariano.iglesias" Date: Sat, 31 May 2008 02:59:55 +0000 Subject: [PATCH] Adding test to show original associations working correctly, disproves and closes #4790 git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7068 3807eeeb-6ff5-0310-8944-8be069107fe0 --- .../libs/model/behaviors/containable.test.php | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/cake/tests/cases/libs/model/behaviors/containable.test.php b/cake/tests/cases/libs/model/behaviors/containable.test.php index 669b22d39..ca6311afa 100644 --- a/cake/tests/cases/libs/model/behaviors/containable.test.php +++ b/cake/tests/cases/libs/model/behaviors/containable.test.php @@ -3060,6 +3060,31 @@ class ContainableTest extends CakeTestCase { $this->assertTrue(Set::matches('/User[id=1]', $r)); $this->assertTrue(Set::matches('/Tag[id=1]', $r)); } + + function testOriginalAssociations() { + $options = array( + 'conditions' => array( + 'Comment.comment' => '!= Crazy', + 'Comment.published' => 'Y', + ), + 'contain' => 'User', + 'recursive' => 1 + ); + + $firstResult = $this->Article->Comment->find('all', $options); + + $dummyResult = $this->Article->Comment->find('all', array( + 'conditions' => array( + 'Comment.comment' => '!= Silly', + 'User.user' => 'mariano' + ), + 'fields' => array('User.password'), + 'contain' => array('User.password'), + )); + + $result = $this->Article->Comment->find('all', $options); + $this->assertEqual($result, $firstResult); + } function __containments(&$Model, $contain = array()) { if (!is_array($Model)) {