Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
guanguans committed May 21, 2023
1 parent 89eb9b7 commit 7e16349
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions tests/Concerns/HasSoarPathTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,26 @@ public function testGetSoarPath(): void
$soar = Soar::create();
$this->assertFileExists($soar->getSoarPath());

// 暂存
$originals = ['isWindows' => OS::isWindows(), 'isMacOS' => OS::isMacOS()];

test::double(OS::class, ['isWindows' => true, 'isMacOS' => false]);
$soar = Soar::create();
$this->assertFileExists($soar->getSoarPath());
$this->assertStringContainsString('windows', $soar->getSoarPath());

test::double(OS::class, ['isWindows' => false, 'isMacOS' => false]);
test::double(OS::class, ['isWindows' => false, 'isMacOS' => true]);
$soar = Soar::create();
$this->assertFileExists($soar->getSoarPath());
$this->assertStringContainsString('linux', $soar->getSoarPath());
$this->assertStringContainsString('darwin', $soar->getSoarPath());

test::double(OS::class, ['isWindows' => false, 'isMacOS' => true]);
test::double(OS::class, ['isWindows' => false, 'isMacOS' => false]);
$soar = Soar::create();
$this->assertFileExists($soar->getSoarPath());
$this->assertStringContainsString('darwin', $soar->getSoarPath());
$this->assertStringContainsString('linux', $soar->getSoarPath());

// 恢复
test::double(OS::class, $originals);
}

public function testInvalidArgumentExceptionForSetSoarPath(): void
Expand Down

0 comments on commit 7e16349

Please sign in to comment.