mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
parent
8d0e1fadf7
commit
e698891d09
2 changed files with 16 additions and 3 deletions
|
@ -655,8 +655,21 @@ class HashTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testFilter() {
|
||||
$result = Hash::filter(array('0', false, true, 0, array('one thing', 'I can tell you', 'is you got to be', false)));
|
||||
$expected = array('0', 2 => true, 3 => 0, 4 => array('one thing', 'I can tell you', 'is you got to be'));
|
||||
$result = Hash::filter(array(
|
||||
'0',
|
||||
false,
|
||||
true,
|
||||
0,
|
||||
0.0,
|
||||
array('one thing', 'I can tell you', 'is you got to be', false)
|
||||
));
|
||||
$expected = array(
|
||||
'0',
|
||||
2 => true,
|
||||
3 => 0,
|
||||
4 => 0.0,
|
||||
5 => array('one thing', 'I can tell you', 'is you got to be')
|
||||
);
|
||||
$this->assertSame($expected, $result);
|
||||
|
||||
$result = Hash::filter(array(1, array(false)));
|
||||
|
|
|
@ -573,7 +573,7 @@ class Hash {
|
|||
* @return bool
|
||||
*/
|
||||
protected static function _filter($var) {
|
||||
if ($var === 0 || $var === '0' || !empty($var)) {
|
||||
if ($var === 0 || $var === 0.0 || $var === '0' || !empty($var)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue