From d1c3cca924d923f98d7d51268f3db1c42c8c0dd8 Mon Sep 17 00:00:00 2001 From: Val Bancer Date: Wed, 12 Jul 2017 20:42:06 +0200 Subject: [PATCH] makes the test more stable --- lib/Cake/Test/Case/Model/ModelWriteTest.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/lib/Cake/Test/Case/Model/ModelWriteTest.php b/lib/Cake/Test/Case/Model/ModelWriteTest.php index 378469b55..52f99908f 100644 --- a/lib/Cake/Test/Case/Model/ModelWriteTest.php +++ b/lib/Cake/Test/Case/Model/ModelWriteTest.php @@ -1673,8 +1673,19 @@ class ModelWriteTest extends BaseModelTest { $this->assertFalse(empty($result)); $this->assertEquals($data['Tag'], $result['Tag']); - $TestModel->unbindModel(array('belongsTo' => array('User'), 'hasMany' => array('Comment'))); - $result = $TestModel->find('first', array('fields' => array('id', 'user_id', 'title', 'body'), 'conditions' => array('Article.id' => 2))); + $TestModel->unbindModel(array( + 'belongsTo' => array('User'), + 'hasMany' => array('Comment'), + )); + $TestModel->bindModel(array( + 'hasAndBelongsToMany' => array( + 'Tag' => array('order' => 'Tag.id'), + ), + ), false); + $result = $TestModel->find('first', array( + 'fields' => array('id', 'user_id', 'title', 'body'), + 'conditions' => array('Article.id' => 2), + )); $expected = array( 'Article' => array( 'id' => '2', @@ -1694,7 +1705,9 @@ class ModelWriteTest extends BaseModelTest { 'tag' => 'tag2', 'created' => '2007-03-18 12:24:23', 'updated' => '2007-03-18 12:26:31' - ))); + ), + ), + ); $this->assertEquals($expected, $result); $data = array('Article' => array('id' => '2'), 'Tag' => array('Tag' => array(2, 3)));