2
2
3
3
namespace TestSuite ;
4
4
5
+ use org \bovigo \vfs \vfsStream ;
6
+ use org \bovigo \vfs \vfsStreamDirectory ;
7
+ use org \bovigo \vfs \vfsStreamFile ;
8
+
5
9
class LinterTest extends \PHPUnit \Framework \TestCase
6
10
{
7
11
/**
@@ -14,6 +18,11 @@ class LinterTest extends \PHPUnit\Framework\TestCase
14
18
*/
15
19
protected $ phpVersion ;
16
20
21
+ /**
22
+ * @var vfsStreamDirectory
23
+ */
24
+ private $ root ;
25
+
17
26
protected function setUp (): void
18
27
{
19
28
$ this ->linter = new \CssLint \Linter ();
@@ -23,6 +32,8 @@ protected function setUp(): void
23
32
} else {
24
33
$ this ->phpVersion = '7 ' ;
25
34
}
35
+
36
+ $ this ->root = vfsStream::setup ('testDir ' );
26
37
}
27
38
28
39
public function testConstructWithCustomCssLintProperties ()
@@ -157,6 +168,21 @@ public function testLintFileWithUnknownFilePathParam()
157
168
$ this ->linter ->lintFile ('wrong ' );
158
169
}
159
170
171
+ public function testLintFileWithUnreadableFilePathParam ()
172
+ {
173
+ $ this ->expectException (\InvalidArgumentException::class);
174
+ $ this ->expectExceptionMessage ('Argument "$sFilePath" "vfs://testDir/foo.txt" is not a readable file path ' );
175
+
176
+ $ testFile = new vfsStreamFile ('foo.txt ' , 0000 );
177
+ $ this ->root ->addChild ($ testFile );
178
+
179
+ $ fileToLint = $ testFile ->url ();
180
+
181
+ $ this ->assertFileIsNotReadable ($ fileToLint );
182
+
183
+ $ this ->linter ->lintFile ($ fileToLint );
184
+ }
185
+
160
186
public function testLintBootstrapCssFile ()
161
187
{
162
188
$ this ->assertTrue (
0 commit comments