Nelmio\Alice\Definition\MethodCallBagTest::testAddingACallCreatesANewBagWithTheAddedInstance PHP Method

testAddingACallCreatesANewBagWithTheAddedInstance() public method

    public function testAddingACallCreatesANewBagWithTheAddedInstance()
    {
        $methodCall1 = new DummyMethodCall('mc1');
        $methodCall2 = new DummyMethodCall('mc2');
        $bag = new MethodCallBag();
        $bag1 = $bag->with($methodCall1);
        $bag2 = $bag1->with($methodCall2);
        $this->assertInstanceOf(MethodCallBag::class, $bag1);
        $this->assertNotSame($bag, $bag1);
        $this->assertSame([], $this->propRefl->getValue($bag));
        $this->assertSame([$methodCall1], $this->propRefl->getValue($bag1));
        $this->assertSame([$methodCall1, $methodCall2], $this->propRefl->getValue($bag2));
    }