mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Add test for #10418
Show that find(list) does not drop keys with values = 0. Refs #10418
This commit is contained in:
parent
fc28eced6b
commit
9dbeeaa1fa
1 changed files with 27 additions and 0 deletions
|
@ -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.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue