iter\IterFnTest::testNestedIndex PHP Method

testNestedIndex() public method

public testNestedIndex ( )
    public function testNestedIndex()
    {
        $getIndexFooBar = fn\nested_index('foo', 'bar');
        $getIndexFooBarBaz = fn\nested_index('foo', 'bar', 'baz');
        $getEmptyIndex = fn\nested_index();
        $array = ['foo' => ['bar' => ['baz' => 42]]];
        $this->assertSame($array['foo']['bar'], $getIndexFooBar($array));
        $this->assertSame($array['foo']['bar']['baz'], $getIndexFooBarBaz($array));
        $this->assertSame($array, $getEmptyIndex($array));
    }