invokeArgs(new SyncVirtualMachine, [$vms, null, 1, 1, &$synced, &$failed]); } public function test_renamed_vm_updates_assigned_module_vmware_name(): void { Schema::disableForeignKeyConstraints(); $vm = VirtualMachines::create(['uuid' => (string) Str::uuid(), 'vm_id' => 'vm-1', 'name' => 'old-name', 'datacenter_id' => 1, 'host_id' => 1]); $linked = ModuleVmware::create(['name' => 'old-name', 'vmware_id' => 'vm-1', 'virtual_machine_id' => $vm->id, 'hostname' => 'customer-host']); $legacy = ModuleVmware::create(['name' => 'old-name', 'vmware_id' => 'vm-1']); $other = ModuleVmware::create(['name' => 'untouched', 'vmware_id' => 'vm-2']); $this->sync([['vm' => 'vm-1', 'name' => 'new-name', 'power_state' => 'POWERED_ON', 'cpu_count' => 2, 'memory_size_MiB' => 2048]]); $this->assertSame('new-name', $vm->fresh()->name); $this->assertSame('new-name', $linked->fresh()->name); $this->assertSame('customer-host', $linked->fresh()->hostname); $this->assertSame('new-name', $legacy->fresh()->name); $this->assertSame($vm->id, (int) $legacy->fresh()->virtual_machine_id); $this->assertSame('untouched', $other->fresh()->name); } }