Browse Source

Improving tests

Jose Lorenzo Rodriguez 12 years ago
parent
commit
7f64c8a88f
1 changed files with 14 additions and 6 deletions
  1. 14 6
      tests/TestCase/ORM/QueryTest.php

+ 14 - 6
tests/TestCase/ORM/QueryTest.php

@@ -1592,20 +1592,28 @@ class QueryTest extends TestCase {
 
 		$query = $table->find()
 			->contain(['authors' => function($q) {
-				return $q->formatResults(function($authors) {
-					return $authors->map(function($author) {
-						$author->idCopy = $author->id;
-						return $author;
+				return $q
+					->formatResults(function($authors) {
+						return $authors->map(function($author) {
+							$author->idCopy = $author->id;
+							return $author;
+						});
+					})
+					->formatResults(function($authors) {
+						return $authors->map(function($author) {
+							$author->idCopy = $author->idCopy + 2;
+							return $author;
+						});
 					});
-				});
 			}]);
 	
 		$query->formatResults(function($results) {
 			return $results->combine('id', 'author.idCopy');
 		});
 		$results = $query->toArray();
-		$expected = [1 => 1, 2 => 3, 3 => 1];
+		$expected = [1 => 3, 2 => 5, 3 => 3];
 		$this->assertEquals($expected, $results);
 	}
 
+
 }