diff --git a/src/SDK/Resource/Detectors/Host.php b/src/SDK/Resource/Detectors/Host.php index 076aef403..0f8920dff 100644 --- a/src/SDK/Resource/Detectors/Host.php +++ b/src/SDK/Resource/Detectors/Host.php @@ -126,7 +126,7 @@ public static function parseMacOsId(string $out): string if (str_contains($line, 'IOPlatformUUID')) { $parts = explode('=', $line); - return trim($parts[1]); + return trim(str_replace('"', '', $parts[1])); } } diff --git a/tests/Unit/SDK/Resource/Detectors/HostTest.php b/tests/Unit/SDK/Resource/Detectors/HostTest.php index dd207364e..b8a396a40 100644 --- a/tests/Unit/SDK/Resource/Detectors/HostTest.php +++ b/tests/Unit/SDK/Resource/Detectors/HostTest.php @@ -27,10 +27,39 @@ public function test_host_get_resource(): void public function test_host_parse_macos_id(): void { - $out = 'IOPlatformUUID=1234567890'; + $out = << + "AAPL,phandle" = <01000000> + "serial-number" = <432123465233514651303544000000000000000000000000000000$ + "IOBusyInterest" = "IOCommand is not serializable" + "target-type" = <"J293"> + "platform-name" = <743831303300000000000000000000000000000000000000000000$ + "secure-root-prefix" = <"md"> + "name" = <"device-tree"> + "region-info" = <4c4c2f41000000000000000000000000000000000000000000000000$ + "manufacturer" = <"Apple Inc."> + "compatible" = <"J293AP","MacBookPro17,1","AppleARM"> + "config-number" = <000000000000000000000000000000000000000000000000000000$ + "IOPlatformSerialNumber" = "A01BC3QFQ05D" + "regulatory-model-number" = <41323333380000000000000000000000000000000000$ + "time-stamp" = <"Mon Jun 27 20:12:10 PDT 2022"> + "clock-frequency" = <00366e01> + "model" = <"MacBookPro17,1"> + "mlb-serial-number" = <432123413230363030455151384c4c314a0000000000000000$ + "model-number" = <4d59443832000000000000000000000000000000000000000000000$ + "IONWInterrupts" = "IONWInterrupts" + "model-config" = <"SUNWAY;MoPED=0x803914B08BE6C5AF0E6C990D7D8240DA4CAC2FF$ + "device_type" = <"bootrom"> + "#size-cells" = <02000000> + "IOPlatformUUID" = "1AB2345C-03E4-57D4-A375-1234D48DE123" + } +END; $hostId = Detectors\Host::parseMacOsId($out); $this->assertIsString($hostId); - $this->assertSame('1234567890', $hostId); + $this->assertSame('1AB2345C-03E4-57D4-A375-1234D48DE123', $hostId); } public function test_host_parse_windows_id(): void