Sokil\Mongo\StructureTest::testGetObject_ClosureClass PHP Method

testGetObject_ClosureClass() public method

    public function testGetObject_ClosureClass()
    {
        $structure = new Structure();
        $structure->set('param1', 'value1');
        $structure->set('param2', array('a' => 'a', 'b' => 'b'));
        // get object
        $structureWrapper = $structure->getObject('param2', function ($data) {
            return '\\Sokil\\Mongo\\StructureWrapper';
        });
        // tests
        $this->assertInstanceOf('\\Sokil\\Mongo\\StructureWrapper', $structureWrapper);
        $this->assertEquals('b', $structureWrapper->get('b'));
        $this->assertEquals('def-c', $structureWrapper->get('c'));
    }