From 95b275dc3b279a665666e0c0c9f9557691d823b3 Mon Sep 17 00:00:00 2001 From: Daniel Feinberg Date: Wed, 31 Aug 2011 00:10:59 -0600 Subject: [PATCH] Adding a test that fails for ticket #1762 Signed-off-by: mark_story --- .../libs/model/behaviors/containable.test.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/cake/tests/cases/libs/model/behaviors/containable.test.php b/cake/tests/cases/libs/model/behaviors/containable.test.php index bfa5a26eb..239fd9252 100644 --- a/cake/tests/cases/libs/model/behaviors/containable.test.php +++ b/cake/tests/cases/libs/model/behaviors/containable.test.php @@ -36,7 +36,7 @@ class ContainableBehaviorTest extends CakeTestCase { */ var $fixtures = array( 'core.article', 'core.article_featured', 'core.article_featureds_tags', 'core.articles_tag', 'core.attachment', 'core.category', - 'core.comment', 'core.featured', 'core.tag', 'core.user' + 'core.comment', 'core.featured', 'core.tag', 'core.user', 'core.join_a', 'core.join_b', 'core.join_c', 'core.join_a_c', 'core.join_a_b' ); /** @@ -3406,6 +3406,21 @@ class ContainableBehaviorTest extends CakeTestCase { $this->assertEqual($expected, array_keys($result)); $this->assertTrue(empty($this->Article->hasMany['ArticlesTag'])); + + $this->JoinA =& ClassRegistry::init('JoinA'); + $this->JoinB =& ClassRegistry::init('JoinB'); + $this->JoinC =& ClassRegistry::init('JoinC'); + + $this->JoinA->Behaviors->attach('Containable'); + $this->JoinB->Behaviors->attach('Containable'); + $this->JoinC->Behaviors->attach('Containable'); + + $this->JoinA->JoinB->find('all', array('contain' => array('JoinA'))); + $this->JoinA->bindModel(array('hasOne' => array('JoinAsJoinC' => array('joinTable' => 'as_cs'))), false); + $result = $this->JoinA->hasOne; + $this->JoinA->find('all'); + $resultAfter = $this->JoinA->hasOne; + $this->assertEqual($result, $resultAfter); } /**