示例#1
0
 /**
  * Test that filter() removes empty values excluding zeroes.
  */
 public function testFilter()
 {
     $data = $this->expanded;
     $match1 = $data;
     $match2 = $data;
     unset($match1['empty'], $match2['empty'], $match1['one']['two']['three']['false'], $match1['one']['two']['three']['null']);
     $this->assertEquals($match1, Hash::filter($data));
     $this->assertEquals($match2, Hash::filter($data, false));
     $data = array('true' => true, 'false' => false, 'null' => null, 'zero' => 0, 'stringZero' => '0', 'empty' => array(), 'array' => array('false' => false, 'null' => null, 'empty' => array()));
     $this->assertEquals(array('true' => true, 'zero' => 0, 'stringZero' => '0'), Hash::filter($data));
 }