Nelmio\Alice\Definition\SpecificationBagTest::testWithersReturnNewModifiedInstance PHP Method

testWithersReturnNewModifiedInstance() public method

    public function testWithersReturnNewModifiedInstance()
    {
        $constructor = null;
        $properties = new PropertyBag();
        $calls = new MethodCallBag();
        $bag = new SpecificationBag($constructor, $properties, $calls);
        $newConstructor = new FakeMethodCall();
        $newBag = $bag->withConstructor($newConstructor);
        $this->assertInstanceOf(SpecificationBag::class, $newBag);
        $this->assertEquals($constructor, $bag->getConstructor());
        $this->assertEquals($calls, $bag->getMethodCalls());
        $this->assertEquals($properties, $bag->getProperties());
        $this->assertEquals(new FakeMethodCall(), $newBag->getConstructor());
        $this->assertEquals($calls, $newBag->getMethodCalls());
        $this->assertEquals($properties, $newBag->getProperties());
    }