Collections\Tests\Dictionary\MapTest::test_map_example PHP Method

test_map_example() public method

public test_map_example ( )
    public function test_map_example()
    {
        $d = new Dictionary('int', 'string');
        $d = $d->add(1, 'a');
        $d = $d->add(2, 'b');
        $m = $d->map(function ($k, $v) {
            return [$k, ord($v)];
        });
        $this->assertEquals('integer', $m->getValueType());
        $this->assertEquals('integer', $m->getKeyType());
        $this->assertEquals(97, $m->get(1));
        $this->assertEquals(98, $m->get(2));
    }