Skip to content

Commit 1e2311a

Browse files
authored
Merge pull request #19 from seregazhuk/file-exists-fix
Fix file stat for cases when file doesn't exist
2 parents 1a326f2 + 5adf6fc commit 1e2311a

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/WoolTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function stat(array $payload)
9898
{
9999
if (!file_exists($payload['path'])) {
100100
return \React\Promise\reject([
101-
'error' => 'Path doesn\'t exist',
101+
'error' => ['message' => 'Path doesn\'t exist'],
102102
]);
103103
}
104104

tests/Adapters/FileTest.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,18 @@ public function testExists(LoopInterface $loop, FilesystemInterface $filesystem)
7979
/**
8080
* @dataProvider filesystemProvider
8181
*/
82-
public function testDoesntExists(LoopInterface $loop, FilesystemInterface $filesystem)
82+
public function testDoesntExist(LoopInterface $loop, FilesystemInterface $filesystem)
8383
{
8484
$this->setLoopTimeout($loop);
85-
$result = false;
85+
$rejectionReason = null;
86+
8687
try {
87-
$this->await($filesystem->file(__FILE__ . '.' . time())->exists(), $loop);
88+
$this->await($filesystem->file(__FILE__ . '.' . time())->stat(), $loop);
8889
} catch (\Exception $e) {
89-
$result = true;
90+
$rejectionReason = $e->getMessage();
9091
}
91-
$this->assertTrue($result);
92+
93+
$this->assertEquals("Path doesn't exist", $rejectionReason);
9294
}
9395

9496
/**

0 commit comments

Comments
 (0)