Skip to content

Commit 5d6d1d6

Browse files
committed
Fix tests
1 parent fdb7827 commit 5d6d1d6

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

tests/Script/Helper/FilesystemTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Tooly\Tests\Script\Helper;
44

5+
use Composer\Util\Platform;
56
use org\bovigo\vfs\vfsStream;
67
use phpmock\phpunit\PHPMock;
78
use Tooly\Script\Helper\Filesystem;
@@ -42,6 +43,10 @@ public function tearDown()
4243

4344
public function testCanRelativeSymlinkAFile()
4445
{
46+
if (Platform::isWindows()) {
47+
$this->markTestSkipped('Symlink not possible on Windows.');
48+
}
49+
4550
$symlink = $this->testDirectory . DIRECTORY_SEPARATOR . '/foo/symlinkOrCopy';
4651

4752
$this->assertTrue($this->filesystem->symlinkFile($this->testFile, $symlink));

tests/Script/Processor/SymlinkTest.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Tooly\Tests\Script\Processor;
44

55
use Composer\IO\ConsoleIO;
6+
use Composer\Util\Platform;
67
use Tooly\Factory\ToolFactory;
78
use Tooly\Script\Configuration;
89
use Tooly\Script\Helper;
@@ -38,7 +39,7 @@ public function setUp()
3839
->getMock();
3940
}
4041

41-
public function testCanCreateASymlink()
42+
public function testCanCreateASymlinkOrCopy()
4243
{
4344
$this->configuration
4445
->expects($this->once())
@@ -49,9 +50,15 @@ public function testCanCreateASymlink()
4950
->getMockBuilder(Filesystem::class)
5051
->getMock();
5152

52-
$filesystem
53-
->expects($this->once())
54-
->method('symlinkFile');
53+
if (Platform::isWindows()) {
54+
$filesystem
55+
->expects($this->once())
56+
->method('copyFile');
57+
} else {
58+
$filesystem
59+
->expects($this->once())
60+
->method('symlinkFile');
61+
}
5562

5663
$this->helper
5764
->expects($this->once())

0 commit comments

Comments
 (0)