Browse Source

Adding failing test to start implementing the duplicate alias detection

Jose Lorenzo Rodriguez 12 years ago
parent
commit
d330732fb2
1 changed files with 11 additions and 1 deletions
  1. 11 1
      tests/TestCase/ORM/QueryRegressionTest.php

+ 11 - 1
tests/TestCase/ORM/QueryRegressionTest.php

@@ -30,7 +30,7 @@ class QueryRegressionTest extends TestCase {
  *
  * @var array
  */
-	public $fixtures = ['core.user', 'core.article', 'core.tag', 'core.articles_tag'];
+	public $fixtures = ['core.user', 'core.article', 'core.tag', 'core.articles_tag', 'core.author'];
 
 /**
  * Tear down
@@ -66,4 +66,14 @@ class QueryRegressionTest extends TestCase {
 		$this->assertEmpty($results);
 	}
 
+	public function testDuplicateAttachableAliases() {
+		$table = TableRegistry::get('Articles');
+		$table->belongsTo('Authors');
+		$table->hasOne('ArticlesTags');
+		$table->Authors->target()->hasOne('Tags', ['foreignKey' => 'id']);
+		$table->ArticlesTags->target()->belongsTo('Tags', ['foreignKey' => 'tag_id']);
+
+		$results = $table->find()->contain(['Authors.Tags', 'ArticlesTags.Tags']);
+	}
+
 }