Test Failed
Push — master ( 0107e6...66b8c9 )
by Bence
05:42
created

RecursiveFileListingTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 22
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testFilterFiles() 0 6 1
A testFindFiles() 0 5 1
A testInvalidDirectory() 0 2 1
1
<?php
2
3
namespace CSFCloud\Tests;
4
5
use PHPUnit\Framework\TestCase;
6
use CSFCloud\RecursiveFileListing;
7
8
final class RecursiveFileListingTest extends TestCase {
9
10
    /**
11
     * @expectedException Exception
12
     */
13
    public function testInvalidDirectory() {
14
        $finder = new RecursiveFileListing(__DIR__ . "/not_existing_dir");
0 ignored issues
show
Unused Code introduced by
The assignment to $finder is dead and can be removed.
Loading history...
15
    }
16
17
    public function testFindFiles() {
18
        $finder = new RecursiveFileListing(__DIR__ . "/RecFileListTestDir");
19
        $files = $finder->scan();
20
21
        $this->assertEquals(3, count($files));
22
    }
23
24
    public function testFilterFiles() {
25
        $finder = new RecursiveFileListing(__DIR__ . "/RecFileListTestDir");
26
        $finder->addFilter('/.*\.txt$/i');
27
        $files = $finder->scan();
28
29
        $this->assertEquals(2, count($files));
30
    }
31
32
}