Exemple #1
0
 public function testFilter()
 {
     $map = new Map(array('a' => 'b', 'c' => 'd', 'e' => 'f'));
     $newMap = $map->filter(function ($v) {
         return $v === 'd';
     });
     $this->assertNotSame($newMap, $map);
     $this->assertCount(3, $map);
     $this->assertCount(1, $newMap);
     $this->assertEquals(array('c' => 'd'), iterator_to_array($newMap));
 }