Nelmio\Alice\ObjectBagTest::testToArray PHP Method

testToArray() public method

public testToArray ( )
    public function testToArray()
    {
        $object1 = new CompleteObject(new SimpleObject('foo', new \stdClass()));
        $object2 = new CompleteObject(new SimpleObject('bar', new \stdClass()));
        $bag = (new ObjectBag())->with($object1)->with($object2);
        $this->assertEquals(['foo' => new \stdClass(), 'bar' => new \stdClass()], $bag->toArray());
        $this->assertEquals(count($bag), count($bag->toArray()));
    }