Adding test to containable, disproves and closes #4790

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7233 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
mariano.iglesias 2008-06-22 00:02:30 +00:00
parent 689c0d9762
commit f7c447aa32

View file

@ -3287,6 +3287,40 @@ class ContainableTest extends CakeTestCase {
$this->assertTrue(Set::matches('/Comment[article_id=1]', $result));
$this->Article->resetBindings();
}
/**
* testResetAssociation method
*
* @access public
*/
function testResetAssociation() {
$this->Article->Behaviors->attach('Containable');
$this->Article->Comment->Behaviors->attach('Containable');
$this->Article->User->Behaviors->attach('Containable');
$initialOptions = array(
'conditions' => array(
'Comment.comment' => '!= Crazy',
'Comment.published' => 'Y',
),
'contain' => 'User',
'recursive' => 1,
);
$initialModels = $this->Article->Comment->find('all', $initialOptions);
$findOptions = array(
'conditions' => array(
'Comment.comment' => '!= Silly',
'User.user' => 'mariano',
),
'fields' => array('User.password'),
'contain' => array('User.password')
);
$result = $this->Article->Comment->find('all', $findOptions);
$result = $this->Article->Comment->find('all', $initialOptions);
$this->assertEqual($result, $initialModels);
}
/**
* containments method
*