diff --git a/cake/tests/cases/console/libs/tasks/model.test.php b/cake/tests/cases/console/libs/tasks/model.test.php index a5f684e6a..9c49bde37 100644 --- a/cake/tests/cases/console/libs/tasks/model.test.php +++ b/cake/tests/cases/console/libs/tasks/model.test.php @@ -416,6 +416,36 @@ class ModelTaskTest extends CakeTestCase { $this->assertEqual($result, $expected); } +/** + * test non interactive doAssociations + * + * @return void + **/ + function testDoAssociationsNonInteractive() { + $this->Task->connection = 'test_suite'; + $this->Task->interactive = false; + $model = new Model(array('ds' => 'test_suite', 'name' => 'Article')); + $result = $this->Task->doAssociations($model); + $expected = array( + 'hasMany' => array( + array( + 'alias' => 'Comment', + 'className' => 'Comment', + 'foreignKey' => 'article_id', + ), + ), + 'hasAndBelongsToMany' => array( + array( + 'alias' => 'Tag', + 'className' => 'Tag', + 'foreignKey' => 'article_id', + 'joinTable' => 'articles_tags', + 'associationForeignKey' => 'tag_id', + ), + ), + ); + + } /** * Ensure that the fixutre object is correctly called. * @@ -448,6 +478,13 @@ class ModelTaskTest extends CakeTestCase { 'className' => 'CategoryThread', 'foreignKey' => 'parent_id', ), + ), + 'belongsTo' => array( + array( + 'alias' => 'User', + 'className' => 'User', + 'foreignKey' => 'user_id', + ), ) ); $model = new Model(array('ds' => 'test_suite', 'name' => 'CategoryThread'));