diff --git a/lib/Cake/Test/Case/Model/ModelReadTest.php b/lib/Cake/Test/Case/Model/ModelReadTest.php index 7723a8cfc..e08acb173 100644 --- a/lib/Cake/Test/Case/Model/ModelReadTest.php +++ b/lib/Cake/Test/Case/Model/ModelReadTest.php @@ -6960,6 +6960,33 @@ class ModelReadTest extends BaseModelTest { $this->assertEquals($expected, $result); } +/** + * test find('list') method + * + * @return void + */ + public function testFindListZeroId() { + $this->loadFixtures('Article'); + + $model = new Article(); + $model->displayField = 'title'; + $model->save(array( + 'title' => 'Zeroth Article', + 'user_id' => 0, + 'published' => 'Y' + )); + + $result = $model->find('list', array( + 'fields' => array('user_id', 'title') + )); + $expected = array( + 0 => 'Zeroth Article', + 1 => 'Third Article', + 3 => 'Second Article' + ); + $this->assertEquals($expected, $result); + } + /** * Test that find(list) works with array conditions that have only one element. *