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
This commit is contained in:
mariano.iglesias 2008-05-31 02:59:55 +00:00
parent 8b122d5480
commit a94c890734

View file

@ -3061,6 +3061,31 @@ class ContainableTest extends CakeTestCase {
$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)) {
$result = $Model->containments($contain);