Add test for #10418

Show that find(list) does not drop keys with values = 0.

Refs #10418
This commit is contained in:
mark_story 2017-03-15 15:58:54 -04:00
parent fc28eced6b
commit 9dbeeaa1fa

View file

@ -6960,6 +6960,33 @@ class ModelReadTest extends BaseModelTest {
$this->assertEquals($expected, $result); $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. * Test that find(list) works with array conditions that have only one element.
* *