Skip to content

Commit d330732

Browse files
committed
Adding failing test to start implementing the duplicate alias detection
1 parent 3047713 commit d330732

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

tests/TestCase/ORM/QueryRegressionTest.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class QueryRegressionTest extends TestCase {
3030
*
3131
* @var array
3232
*/
33-
public $fixtures = ['core.user', 'core.article', 'core.tag', 'core.articles_tag'];
33+
public $fixtures = ['core.user', 'core.article', 'core.tag', 'core.articles_tag', 'core.author'];
3434

3535
/**
3636
* Tear down
@@ -66,4 +66,14 @@ public function testEagerLoadingFromEmptyResults() {
6666
$this->assertEmpty($results);
6767
}
6868

69+
public function testDuplicateAttachableAliases() {
70+
$table = TableRegistry::get('Articles');
71+
$table->belongsTo('Authors');
72+
$table->hasOne('ArticlesTags');
73+
$table->Authors->target()->hasOne('Tags', ['foreignKey' => 'id']);
74+
$table->ArticlesTags->target()->belongsTo('Tags', ['foreignKey' => 'tag_id']);
75+
76+
$results = $table->find()->contain(['Authors.Tags', 'ArticlesTags.Tags']);
77+
}
78+
6979
}

0 commit comments

Comments
 (0)