Browse Source

Fixed last remaining failing test and completing test case for duplicate
aliases

Jose Lorenzo Rodriguez 12 years ago
parent
commit
d657371332
2 changed files with 10 additions and 1 deletions
  1. 1 0
      src/ORM/EagerLoader.php
  2. 9 1
      tests/TestCase/ORM/QueryRegressionTest.php

+ 1 - 0
src/ORM/EagerLoader.php

@@ -106,6 +106,7 @@ class EagerLoader {
 		$associations = (array)$associations;
 		$associations = $this->_reformatContain($associations, $this->_containments);
 		$this->_normalized = $this->_loadExternal = null;
+		$this->_aliasList = [];
 		return $this->_containments = $associations;
 	}
 

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

@@ -85,8 +85,16 @@ class QueryRegressionTest extends TestCase {
 
 		$results = $table->find()
 			->contain(['Authors.Stuff', 'Things.Stuff'])
-			->hydrate(false)
 			->toArray();
+
+		$this->assertEquals(1, $results[0]->articles_tag->foo->id);
+		$this->assertEquals(1, $results[0]->author->favorite_tag->id);
+		$this->assertEquals(2, $results[1]->articles_tag->foo->id);
+		$this->assertEquals(1, $results[0]->author->favorite_tag->id);
+		$this->assertEquals(1, $results[2]->articles_tag->foo->id);
+		$this->assertEquals(3, $results[2]->author->favorite_tag->id);
+		$this->assertEquals(3, $results[3]->articles_tag->foo->id);
+		$this->assertEquals(3, $results[3]->author->favorite_tag->id);
 	}
 
 }