Skip to content

Commit 34c0981

Browse files
committed
Failing test for issue #29
1 parent 1c65972 commit 34c0981

File tree

3 files changed

+48
-2
lines changed

3 files changed

+48
-2
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
tests/.test_fs
1+
.test_fs
22
build/
33
vendor/
44
phpctags

tests/Acceptance/AcceptanceTestCase.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ abstract class AcceptanceTestCase extends PHPUnit_Framework_TestCase
3333

3434
protected function setUp()
3535
{
36-
$this->testDir = __DIR__ . '/../.test_fs';
36+
$this->testDir = __DIR__ . '/../../.test_fs';
3737

3838
if (!file_exists($this->testDir)) {
3939
mkdir($this->testDir);
@@ -57,6 +57,20 @@ protected function givenSourceFile($filename, $content)
5757
file_put_contents($filename, $content);
5858
}
5959

60+
protected function givenDirectory($dirname)
61+
{
62+
$dirname = $this->testDir . DIRECTORY_SEPARATOR . $dirname;
63+
64+
mkdir($dirname);
65+
}
66+
67+
protected function givenMode($file, $mode)
68+
{
69+
$file = $this->testDir . DIRECTORY_SEPARATOR . $file;
70+
71+
chmod($file, $mode);
72+
}
73+
6074
/**
6175
* @return void
6276
*/
@@ -177,6 +191,10 @@ private function emptyTestDir()
177191
throw \RuntimeException('Test directory does not exist');
178192
}
179193

194+
foreach (glob($this->testDir . DIRECTORY_SEPARATOR . '*') as $file) {
195+
chmod($file, 0755);
196+
}
197+
180198
$files = new RecursiveIteratorIterator(
181199
new RecursiveDirectoryIterator(
182200
$this->testDir,
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
namespace tests\PHPCTags\Acceptance;
4+
5+
final class FilesystemTest extends AcceptanceTestCase
6+
{
7+
/**
8+
* @test
9+
*/
10+
public function itSkipsUnreadableDirectories()
11+
{
12+
$this->givenDirectory('unreadable');
13+
$this->givenSourceFile('unreadable/UnreadableClass.php', <<<EOS
14+
<?php
15+
16+
class UnreadableClass
17+
{
18+
}
19+
EOS
20+
);
21+
$this->givenMode('unreadable', 0000);
22+
23+
$this->runPHPCtags();
24+
$this->assertTagsFileHeaderIsCorrect();
25+
26+
$this->assertTagsFileContainsNoTagsFromFile('unreadable/UnreadableClass.php');
27+
}
28+
}

0 commit comments

Comments
 (0)