Nelmio\Alice\ObjectBagTest::testWithersReturnNewModifiedInstance PHP Method

testWithersReturnNewModifiedInstance() public method

    public function testWithersReturnNewModifiedInstance()
    {
        $bag = new ObjectBag(['foo' => new \stdClass()]);
        $std = new \stdClass();
        $std->ping = 'pong';
        $newBag = $bag->with(new CompleteObject(new SimpleObject('bar', $std)));
        $this->assertEquals(new ObjectBag(['foo' => new \stdClass()]), $bag);
        $this->assertEquals(new ObjectBag(['foo' => new \stdClass(), 'bar' => new CompleteObject(new SimpleObject('bar', $std))]), $newBag);
    }