mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
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:
parent
8b122d5480
commit
a94c890734
1 changed files with 25 additions and 0 deletions
|
@ -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)) {
|
||||
|
|
Loading…
Add table
Reference in a new issue