Browse Source

Improving test to show the internal use of union queries in marshaller

Jose Lorenzo Rodriguez 11 years ago
parent
commit
b8eeb556d1
1 changed files with 15 additions and 2 deletions
  1. 15 2
      tests/TestCase/ORM/MarshallerTest.php

+ 15 - 2
tests/TestCase/ORM/MarshallerTest.php

@@ -774,6 +774,7 @@ class MarshallerTest extends TestCase {
 				['id' => 2, 'comment' => 'Altered comment 2'],
 				['id' => 1, 'comment' => 'Altered comment 1'],
 				['id' => 3, 'comment' => 'Extra comment 3'],
+				['id' => 4, 'comment' => 'Extra comment 4'],
 				['comment' => 'Extra comment 2']
 			]
 		];
@@ -797,14 +798,26 @@ class MarshallerTest extends TestCase {
 			['comment' => 'Extra comment 3'] + $thirdComment,
 			$entity->comments[2]->toArray()
 		);
+
+		$forthComment = $this->articles->Comments
+			->find()
+			->where(['id' => 4])
+			->hydrate(false)
+			->first();
+
 		$this->assertEquals(
-			['comment' => 'Extra comment 1'],
+			['comment' => 'Extra comment 4'] + $forthComment,
 			$entity->comments[3]->toArray()
 		);
+
 		$this->assertEquals(
-			['comment' => 'Extra comment 2'],
+			['comment' => 'Extra comment 1'],
 			$entity->comments[4]->toArray()
 		);
+		$this->assertEquals(
+			['comment' => 'Extra comment 2'],
+			$entity->comments[5]->toArray()
+		);
 	}
 
 /**