1010use League \Flysystem \UnableToDeleteFile ;
1111use League \Flysystem \UnableToMoveFile ;
1212use League \Flysystem \UnableToWriteFile ;
13- use VirtualFileSystem \ FileSystem as Vfs ;
13+ use org \ bovigo \ vfs \ vfsStream as Vfs ;
1414
1515class DefaultWriterTest extends TestCase
1616{
@@ -43,9 +43,8 @@ public function setUp(): void
4343 $ this ->settings
4444 );
4545
46- $ this ->vfs = new Vfs ();
47- mkdir ($ this ->vfs ->path ('/tmp ' ));
48- file_put_contents ($ this ->vfs ->path ('/tmp/tempfile ' ), 'content ' );
46+ $ this ->vfs = Vfs::setup ('tmp ' );
47+ file_put_contents ($ this ->vfs ->url () . '/tempfile ' , 'content ' );
4948 }
5049
5150 public function testIsWriterInterface ()
@@ -57,11 +56,11 @@ public function testInvoke()
5756 {
5857 $ this ->assertEquals ([], $ this ->writer ->write ([]));
5958 $ this ->assertEquals ([true ], $ this ->writer ->write ([
60- $ this ->vfs ->path ( ' /tmp/ tempfile ') => 'file.txt ' ,
59+ $ this ->vfs ->url () . ' / tempfile ' => 'file.txt ' ,
6160 ], 'field ' , []));
6261
6362 $ this ->assertEquals ([false ], $ this ->writer ->write ([
64- $ this ->vfs ->path ( ' /tmp/ invalid.txt ') => 'file.txt ' ,
63+ $ this ->vfs ->url () . ' / invalid.txt ' => 'file.txt ' ,
6564 ], 'field ' , []));
6665 }
6766
@@ -78,11 +77,11 @@ public function testDelete()
7877
7978 $ this ->assertEquals ([], $ writer ->delete ([]));
8079 $ this ->assertEquals ([true ], $ writer ->delete ([
81- $ this ->vfs ->path ( ' /tmp/ tempfile ') ,
80+ $ this ->vfs ->url () . ' / tempfile ' ,
8281 ]));
8382
8483 $ this ->assertEquals ([false ], $ writer ->delete ([
85- $ this ->vfs ->path ( ' /tmp/ invalid.txt ') ,
84+ $ this ->vfs ->url () . ' / invalid.txt ' ,
8685 ]));
8786 }
8887
@@ -92,19 +91,19 @@ public function testWriteFile()
9291 $ filesystem ->expects ($ this ->once ())->method ('writeStream ' );
9392 $ filesystem ->expects ($ this ->exactly (3 ))->method ('delete ' );
9493 $ filesystem ->expects ($ this ->once ())->method ('move ' );
95- $ this ->assertTrue ($ this ->writer ->writeFile ($ filesystem , $ this ->vfs ->path ( ' /tmp/ tempfile ') , 'path ' ));
94+ $ this ->assertTrue ($ this ->writer ->writeFile ($ filesystem , $ this ->vfs ->url () . ' / tempfile ' , 'path ' ));
9695
9796 $ filesystem = $ this ->getMockBuilder ('League\Flysystem\FilesystemOperator ' )->getMock ();
9897 $ filesystem ->expects ($ this ->once ())->method ('writeStream ' )->will ($ this ->throwException (new UnableToWriteFile ()));
9998 $ filesystem ->expects ($ this ->exactly (2 ))->method ('delete ' );
10099 $ filesystem ->expects ($ this ->never ())->method ('move ' );
101- $ this ->assertFalse ($ this ->writer ->writeFile ($ filesystem , $ this ->vfs ->path ( ' /tmp/ tempfile ') , 'path ' ));
100+ $ this ->assertFalse ($ this ->writer ->writeFile ($ filesystem , $ this ->vfs ->url () . ' / tempfile ' , 'path ' ));
102101
103102 $ filesystem = $ this ->getMockBuilder ('League\Flysystem\FilesystemOperator ' )->getMock ();
104103 $ filesystem ->expects ($ this ->once ())->method ('writeStream ' );
105104 $ filesystem ->expects ($ this ->exactly (3 ))->method ('delete ' );
106105 $ filesystem ->expects ($ this ->once ())->method ('move ' )->will ($ this ->throwException (new UnableToMoveFile ()));
107- $ this ->assertFalse ($ this ->writer ->writeFile ($ filesystem , $ this ->vfs ->path ( ' /tmp/ tempfile ') , 'path ' ));
106+ $ this ->assertFalse ($ this ->writer ->writeFile ($ filesystem , $ this ->vfs ->url () . ' / tempfile ' , 'path ' ));
108107 }
109108
110109 public function testDeletePath ()
0 commit comments