Skip to content

Commit f8afc6d

Browse files
committed
fix errors
1 parent 21da37a commit f8afc6d

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

tests/Storage/Device/LocalTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use PHPUnit\Framework\TestCase;
66
use Utopia\Storage\Device\AWS;
77
use Utopia\Storage\Device\Local;
8+
use Utopia\Storage\Exception\NotFoundException;
89

910
class LocalTest extends TestCase
1011
{
@@ -75,6 +76,12 @@ public function testRead()
7576
$this->object->delete($this->object->getPath('text-for-read.txt'));
7677
}
7778

79+
public function testReadNonExistentFile()
80+
{
81+
$this->expectException(NotFoundException::class);
82+
$this->object->read($this->object->getPath('non-existent-file.txt'));
83+
}
84+
7885
public function testFileExists()
7986
{
8087
$this->assertEquals($this->object->write($this->object->getPath('text-for-test-exists.txt'), 'Hello World'), true);

tests/Storage/S3Base.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use PHPUnit\Framework\TestCase;
66
use Utopia\Storage\Device\Local;
77
use Utopia\Storage\Device\S3;
8+
use Utopia\Storage\Exception\NotFoundException;
89

910
abstract class S3Base extends TestCase
1011
{
@@ -133,6 +134,12 @@ public function testRead()
133134
$this->object->delete($this->object->getPath('text-for-read.txt'));
134135
}
135136

137+
public function testReadNonExistentFile()
138+
{
139+
$this->expectException(NotFoundException::class);
140+
$this->object->read($this->object->getPath('non-existent-file.txt'));
141+
}
142+
136143
public function testFileExists()
137144
{
138145
$this->assertEquals(true, $this->object->exists($this->object->getPath('testing/kitten-1.jpg')));
@@ -410,4 +417,15 @@ public function testTransferSmall()
410417
$this->object->delete($path);
411418
$device->delete($destination);
412419
}
420+
421+
public function testTransferNonExistentFile()
422+
{
423+
$device = new Local(__DIR__.'/../resources/disk-a');
424+
425+
$path = $this->object->getPath('non-existent-file.txt');
426+
$destination = $device->getPath('hello.txt');
427+
428+
$this->expectException(NotFoundException::class);
429+
$this->object->transfer($path, $destination, $device);
430+
}
413431
}

0 commit comments

Comments
 (0)