From 68234dd52904bb45026a9b14f8d1255a646a05e7 Mon Sep 17 00:00:00 2001 From: nate Date: Thu, 15 May 2008 07:08:16 +0000 Subject: [PATCH] Adding tests for HABTM unique key, disproves #3859 git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6887 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/tests/cases/libs/model/model.test.php | 5 +++++ cake/tests/cases/libs/model/models.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cake/tests/cases/libs/model/model.test.php b/cake/tests/cases/libs/model/model.test.php index 8dac09435..ebbc5ec20 100644 --- a/cake/tests/cases/libs/model/model.test.php +++ b/cake/tests/cases/libs/model/model.test.php @@ -190,6 +190,11 @@ class ModelTest extends CakeTestCase { $this->assertEqual($result, $expected); } + function testHabtmUniqueKey() { + $model =& new Item(); + $this->assertFalse($model->hasAndBelongsToMany['Portfolio']['unique']); + } + function testHasManyLimitOptimization() { $this->loadFixtures('Project', 'Thread', 'Message', 'Bid'); $Project =& new Project(); diff --git a/cake/tests/cases/libs/model/models.php b/cake/tests/cases/libs/model/models.php index ef89b93ff..cb818c9e2 100644 --- a/cake/tests/cases/libs/model/models.php +++ b/cake/tests/cases/libs/model/models.php @@ -447,7 +447,7 @@ class Portfolio extends CakeTestModel { class Item extends CakeTestModel { var $name = 'Item'; var $belongsTo = array('Syfile' => array('counterCache' => true)); - var $hasAndBelongsToMany = array('Portfolio'); + var $hasAndBelongsToMany = array('Portfolio' => array('unique' => false)); } class ItemsPortfolio extends CakeTestModel { var $name = 'ItemsPortfolio';