Exemplo n.º 1
0
 public function testFilterKey()
 {
     $array = ["a" => 1, "b" => 2, "c" => 3];
     $map = new Map($array);
     $filtered = $map->filterKey(function ($_) {
         return $_ === "a";
     });
     $this->assertTrue($filtered instanceof Map);
     $this->assertEquals($array, $map->toArray());
     //check original Map is not altered
     $this->assertEquals(1, $filtered->count());
     $this->assertEquals(1, $filtered->get("a"));
 }