Nelmio\Alice\Definition\MethodCall\OptionalMethodCallTest::testIsMutable PHP Method

testIsMutable() public method

public testIsMutable ( )
    public function testIsMutable()
    {
        $caller = new MutableMethodCall(new MutableReference(), 'mutate', [$arg0 = new \stdClass()]);
        $flag = new OptionalFlag(30);
        $definition = new OptionalMethodCall($caller, $flag);
        // Mutate before reading values
        $caller->setMethod(new DummyMethodCall('dummy'));
        $arg0->foo = 'bar';
        // Mutate retrieved values
        $definition->getCaller()->setId('mutated');
        $definition->getArguments()[0]->foz = 'baz';
        $this->assertEquals(new MutableReference(), $definition->getCaller());
        $this->assertEquals([StdClassFactory::create(['foo' => 'bar', 'foz' => 'baz'])], $definition->getArguments());
    }