File tree Expand file tree Collapse file tree 4 files changed +12
-7
lines changed Expand file tree Collapse file tree 4 files changed +12
-7
lines changed Original file line number Diff line number Diff line change 30
30
"require-dev" : {
31
31
"phpunit/phpunit" : " >= 7.5" ,
32
32
"guzzlehttp/guzzle" : " >= 6.3" ,
33
- "ext-zip" : " *"
33
+ "ext-zip" : " *" ,
34
+ "mikey179/vfsStream" : " ^1.6"
34
35
},
35
36
"autoload" : {
36
37
"psr-4" : {
Original file line number Diff line number Diff line change @@ -17,6 +17,6 @@ class FileNotFoundException extends Exception
17
17
*/
18
18
public function __construct (string $ path )
19
19
{
20
- parent ::__construct ("Ths file with the path $ path wasn't found. " );
20
+ parent ::__construct ("The file with the path $ path wasn't found. " );
21
21
}
22
22
}
Original file line number Diff line number Diff line change @@ -17,6 +17,6 @@ class FileNotReadableException extends Exception
17
17
*/
18
18
public function __construct (string $ path )
19
19
{
20
- parent ::__construct ("Ths file with the path $ path isn't readable. " );
20
+ parent ::__construct ("The file with the path $ path isn't readable. " );
21
21
}
22
22
}
Original file line number Diff line number Diff line change 3
3
4
4
namespace ZipStreamTest ;
5
5
6
+ use org \bovigo \vfs \vfsStream ;
6
7
use GuzzleHttp \Psr7 \Response ;
7
8
use PHPUnit \Framework \TestCase ;
8
9
use ZipStream \File ;
@@ -31,10 +32,13 @@ public function testFileNotFoundException(): void
31
32
32
33
public function testFileNotReadableException (): void
33
34
{
34
- // TODO: $this->expectException(\ZipStream\Exception\FileNotReadableException::class);
35
-
36
- // TODO: How to test this?
37
- $ this ->markTestIncomplete ('How to test this? ' );
35
+ // create new virtual filesystem
36
+ $ root = vfsStream::setup ('vfs ' );
37
+ // create a virtual file with no permissions
38
+ $ file = vfsStream::newFile ('foo.txt ' , 0000 )->at ($ root )->setContent ('bar ' );
39
+ $ zip = new ZipStream ();
40
+ $ this ->expectException (\ZipStream \Exception \FileNotReadableException::class);
41
+ $ zip ->addFileFromPath ('foo.txt ' , $ file ->url ());
38
42
}
39
43
40
44
public function testDostime (): void
You can’t perform that action at this time.
0 commit comments