File tree Expand file tree Collapse file tree 2 files changed +22
-7
lines changed
Expand file tree Collapse file tree 2 files changed +22
-7
lines changed Original file line number Diff line number Diff line change 44
55namespace Laravel \Boost \Install ;
66
7+ use Laravel \Boost \Install \Enums \Platform ;
8+
79class Herd
810{
911 public function isInstalled (): bool
1012 {
11- $ isWindows = PHP_OS_FAMILY === 'Windows ' ;
12-
13- if (! $ isWindows ) {
13+ if ($ this ->isWindowsPlatform ()) {
1414 return file_exists ('/Applications/Herd.app/Contents/MacOS/Herd ' );
1515 }
1616
@@ -24,7 +24,7 @@ public function isMcpAvailable(): bool
2424
2525 public function getHomePath (): string
2626 {
27- if (PHP_OS_FAMILY === ' Windows ' ) {
27+ if ($ this -> isWindowsPlatform () ) {
2828 if (! isset ($ _SERVER ['HOME ' ])) {
2929 $ _SERVER ['HOME ' ] = $ _SERVER ['USERPROFILE ' ];
3030 }
@@ -37,12 +37,15 @@ public function getHomePath(): string
3737
3838 public function mcpPath (): string
3939 {
40- $ isWindows = PHP_OS_FAMILY === 'Windows ' ;
41-
42- if ($ isWindows ) {
40+ if ($ this ->isWindowsPlatform ()) {
4341 return $ this ->getHomePath ().'/.config/herd/bin/herd-mcp.phar ' ;
4442 }
4543
4644 return $ this ->getHomePath ().'/Library/Application Support/Herd/bin/herd-mcp.phar ' ;
4745 }
46+
47+ public function isWindowsPlatform (): bool
48+ {
49+ return Platform::current () === Platform::Windows;
50+ }
4851}
Original file line number Diff line number Diff line change @@ -175,3 +175,15 @@ function getHerdTestTempDir(): string
175175
176176 expect ($ herd ->isInstalled ())->toBeFalse ();
177177})->onlyOnWindows ();
178+
179+ test ('isWindowsPlatform returns true on Windows ' , function () {
180+ $ herd = new Herd ();
181+
182+ expect ($ herd ->isWindowsPlatform ())->toBeTrue ();
183+ })->onlyOnWindows ();
184+
185+ test ('isWindowsPlatform returns false on non-Windows platforms ' , function () {
186+ $ herd = new Herd ();
187+
188+ expect ($ herd ->isWindowsPlatform ())->toBeFalse ();
189+ })->skipOnWindows ();
You can’t perform that action at this time.
0 commit comments