Browse Source

adding sort on testresults, to avoid incorrect order returned by MySQL

Ceeram 14 years ago
parent
commit
9fd04307ff
1 changed files with 11 additions and 10 deletions
  1. 11 10
      lib/Cake/Test/Case/Model/ModelWriteTest.php

+ 11 - 10
lib/Cake/Test/Case/Model/ModelWriteTest.php

@@ -1662,6 +1662,7 @@ class ModelWriteTest extends BaseModelTest {
 		$TestModel->id = 2;
 		$TestModel->save($data);
 		$result = $TestModel->findById(2);
+		$result['Item'] = Set::sort($result['Item'], '{n}.id', 'asc');
 		$expected = array(
 			'Portfolio' => array(
 				'id' => 2,
@@ -1670,24 +1671,24 @@ class ModelWriteTest extends BaseModelTest {
 			),
 			'Item' => array(
 				array(
-					'id' => 2,
-					'syfile_id' => 2,
+					'id' => 1,
+					'syfile_id' => 1,
 					'published' => '',
-					'name' => 'Item 2',
+					'name' => 'Item 1',
 					'ItemsPortfolio' => array(
-						'id' => 8,
-						'item_id' => 2,
+						'id' => 7,
+						'item_id' => 1,
 						'portfolio_id' => 2
 					)
 				),
 				array(
-					'id' => 1,
-					'syfile_id' => 1,
+					'id' => 2,
+					'syfile_id' => 2,
 					'published' => '',
-					'name' => 'Item 1',
+					'name' => 'Item 2',
 					'ItemsPortfolio' => array(
-						'id' => 7,
-						'item_id' => 1,
+						'id' => 8,
+						'item_id' => 2,
 						'portfolio_id' => 2
 					)
 				)