Skip to content

[6.x] Fix Filesystem tests failing in Windows #32975

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions tests/Filesystem/FilesystemAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,10 @@ public function testPutWithStreamInterface()
$spy = m::spy($this->filesystem);

$filesystemAdapter = new FilesystemAdapter($spy);
$stream = new Stream(fopen($this->tempDir.'/foo.txt', 'r'));
$filesystemAdapter->put('bar.txt', $stream);
$stream = fopen($this->tempDir.'/foo.txt', 'r');
$guzzleStream = new Stream($stream);
$filesystemAdapter->put('bar.txt', $guzzleStream);
fclose($stream);

$spy->shouldHaveReceived('putStream');
$this->assertEquals('some-data', $filesystemAdapter->get('bar.txt'));
Expand Down
16 changes: 15 additions & 1 deletion tests/Filesystem/FilesystemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,22 @@ public function testPutStoresFiles()
$this->assertStringEqualsFile($this->tempDir.'/file.txt', 'Hello World');
}

public function testReplaceStoresFiles()
public function testReplaceCreatesFile()
{
$tempFile = "{$this->tempDir}/file.txt";

$filesystem = new Filesystem;

$filesystem->replace($tempFile, 'Hello World');
$this->assertStringEqualsFile($tempFile, 'Hello World');
}

public function testReplaceWhenUnixSymlinkExists()
{
if (windows_os()) {
$this->markTestSkipped('Skipping since operating system is Windows');
}

$tempFile = "{$this->tempDir}/file.txt";
$symlinkDir = "{$this->tempDir}/symlink_dir";
$symlink = "{$symlinkDir}/symlink.txt";
Expand Down