22
33namespace TestSuite ;
44
5+ use org \bovigo \vfs \vfsStream ;
6+ use org \bovigo \vfs \vfsStreamDirectory ;
7+ use org \bovigo \vfs \vfsStreamFile ;
8+
59class LinterTest extends \PHPUnit \Framework \TestCase
610{
711 /**
@@ -14,6 +18,11 @@ class LinterTest extends \PHPUnit\Framework\TestCase
1418 */
1519 protected $ phpVersion ;
1620
21+ /**
22+ * @var vfsStreamDirectory
23+ */
24+ private $ root ;
25+
1726 protected function setUp (): void
1827 {
1928 $ this ->linter = new \CssLint \Linter ();
@@ -23,6 +32,8 @@ protected function setUp(): void
2332 } else {
2433 $ this ->phpVersion = '7 ' ;
2534 }
35+
36+ $ this ->root = vfsStream::setup ('testDir ' );
2637 }
2738
2839 public function testConstructWithCustomCssLintProperties ()
@@ -157,6 +168,21 @@ public function testLintFileWithUnknownFilePathParam()
157168 $ this ->linter ->lintFile ('wrong ' );
158169 }
159170
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+
160186 public function testLintBootstrapCssFile ()
161187 {
162188 $ this ->assertTrue (
0 commit comments