Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding tests for doAssociations

  • Loading branch information...
commit ef519621b476f398ea65324384e837833a427b64 1 parent 6be70c3
@markstory markstory authored
Showing with 37 additions and 0 deletions.
  1. +37 −0 cake/tests/cases/console/libs/tasks/model.test.php
View
37 cake/tests/cases/console/libs/tasks/model.test.php
@@ -417,6 +417,36 @@ function testHasAndBelongsToManyGeneration() {
}
/**
+ * 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.
*
* @return void
@@ -448,6 +478,13 @@ function testConfirmAssociations() {
'className' => 'CategoryThread',
'foreignKey' => 'parent_id',
),
+ ),
+ 'belongsTo' => array(
+ array(
+ 'alias' => 'User',
+ 'className' => 'User',
+ 'foreignKey' => 'user_id',
+ ),
)
);
$model = new Model(array('ds' => 'test_suite', 'name' => 'CategoryThread'));
Please sign in to comment.
Something went wrong with that request. Please try again.