public function testCanCreateANewInstanceWithArguments()
{
$caller = new InstantiatedReference('user.factory');
$method = 'setUsername';
$arguments = [new \stdClass()];
$definition = new MethodCallWithReference($caller, $method, $arguments);
$newArguments = [$arg0 = new \stdClass()];
$newDefinition = $definition->withArguments($newArguments);
// Mutate argument before reading it
$arg0->foo = 'bar';
$this->assertInstanceOf(MethodCallWithReference::class, $newDefinition);
$this->assertEquals($caller, $definition->getCaller());
$this->assertEquals($method, $definition->getMethod());
$this->assertEquals($arguments, $definition->getArguments());
$this->assertEquals($caller, $newDefinition->getCaller());
$this->assertEquals($method, $newDefinition->getMethod());
$this->assertEquals([StdClassFactory::create(['foo' => 'bar'])], $newDefinition->getArguments());
}