Skip to content

Commit 95d6448

Browse files
committed
test(SoarTest): Remove OS check for help option skip
- Remove the skip condition for the help option test on Windows. - This allows the test to run on Windows, ensuring coverage for that platform. - Updated to improve cross-platform compatibility for the Soar help option.
1 parent cf9f843 commit 95d6448

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

src/Concerns/WithRunable.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
*/
2121
trait WithRunable
2222
{
23+
protected Process $process;
24+
2325
/** @var null|callable */
2426
protected $processTapper;
2527

@@ -56,6 +58,6 @@ protected function toProcess(): Process
5658
($this->processTapper)($process);
5759
}
5860

59-
return $process;
61+
return $this->process = $process;
6062
}
6163
}

src/Soar.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ public function __construct(array $options = [], ?string $soarBinary = null)
4444
*/
4545
public function help(): string
4646
{
47-
return $this->clone()->setHelp(true)->run();
47+
$soar = $this->clone();
48+
49+
return $soar->setHelp(true)->run() ?: $soar->process->getErrorOutput();
4850
}
4951

5052
/**

tests/SoarTest.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,11 @@
2323
use function Spatie\Snapshots\assertMatchesTextSnapshot;
2424

2525
it('can get help', function (): void {
26-
expect(Soar::make())->help()->toContain('-version');
27-
})->group(__DIR__, __FILE__)->skip(OS::isWindows(), 'The help option of Soar is not supported on Windows.');
26+
// $process = new Symfony\Component\Process\Process([__DIR__.'/../bin/soar.windows-amd64', '-help=true']);
27+
// $process->run();
28+
// dump($process->getErrorOutput(), $process->getOutput());
29+
expect(Soar::make())->help()->dd()->toContain('-version');
30+
})->group(__DIR__, __FILE__)/* ->skip(OS::isWindows(), 'The help option of Soar is not supported on Windows.') */;
2831

2932
it('can get help snapshot', function (): void {
3033
assertMatchesTextSnapshot(

0 commit comments

Comments
 (0)