File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55use PHPUnit \Framework \TestCase ;
66use Utopia \Storage \Device \AWS ;
77use Utopia \Storage \Device \Local ;
8+ use Utopia \Storage \Exception \NotFoundException ;
89
910class 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 );
Original file line number Diff line number Diff line change 55use PHPUnit \Framework \TestCase ;
66use Utopia \Storage \Device \Local ;
77use Utopia \Storage \Device \S3 ;
8+ use Utopia \Storage \Exception \NotFoundException ;
89
910abstract 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}
You can’t perform that action at this time.
0 commit comments