Skip to content
Open
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
2 changes: 2 additions & 0 deletions src/Flysystem/StreamCommand/StreamStatCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ public static function getRemoteStats(FileData $current): array
[$mode, $size, $lastModified] = self::getRemoteDirectoryStats($current, $converter, $visibility);
} elseif ($current->filesystem->fileExists($current->file)) {
[$mode, $size, $lastModified] = self::getRemoteFileStats($current, $converter, $visibility);
} else {
throw $e;
}
} else {
throw $e;
Expand Down
20 changes: 20 additions & 0 deletions tests/StreamCommand/StreamStatTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/*
* This file is part of the flysystem-stream-wrapper package.
*
Expand Down Expand Up @@ -155,6 +156,25 @@ public function testLastModified(): void
}
}

public function testLastModifiedException(): void
{
$current = $this->getCurrent();

/** @var MockObject $filesystem */
$filesystem = $current->filesystem;
$filesystem->method('visibility')
->with('test')
->willReturn(Visibility::PUBLIC);
$filesystem->method('lastModified')
->with('test')
->willThrowException(UnableToRetrieveMetadata::lastModified(self::TEST_PATH));

$this->assertFalse(@StreamStatCommand::run($current));

$this->expectErrorWithMessage('Stat failed');
StreamStatCommand::run($current);
}

public function testRemoteException(): void
{
$current = $this->getCurrent();
Expand Down