Skip to content

Commit

Permalink
Adding failing test to start implementing the duplicate alias detection
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Apr 2, 2014
1 parent 3047713 commit d330732
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tests/TestCase/ORM/QueryRegressionTest.php
Expand Up @@ -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
Expand Down Expand Up @@ -66,4 +66,14 @@ public function testEagerLoadingFromEmptyResults() {
$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']);
}

}

0 comments on commit d330732

Please sign in to comment.