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

test_map_infers_type_for_dict() public method

    public function test_map_infers_type_for_dict()
    {
        $d = new Dictionary('string', 'int');
        $d = $d->add('a', 1);
        //change key to 42
        $m = $d->map(function ($k, $v) {
            return [42, $v];
        });
        $this->assertEquals('integer', $m->getValueType());
        $this->assertEquals('integer', $m->getKeyType());
        $this->assertTrue($m->exists(42));
        $this->assertEquals(1, $m->get(42));
    }