Completed
Push — master ( ea9d41...184c59 )
by Sergii
08:21
created

PathTest::testFilter()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 7
nc 1
nop 2
1
<?php
2
namespace Tests\AppBundle\Sync\Entity\Filter;
3
4
use AppBundle\Sync\Entity\File;
5
use AppBundle\Sync\Entity\Filter\Path;
6
7
/**
8
 * Path filter tests
9
 *
10
 * @author Sergey Sadovoi <[email protected]>
11
 */
12
class PathTest extends \PHPUnit_Framework_TestCase
13
{
14
    /**
15
     * @dataProvider pathProvider
16
     */
17
    public function testFilter($path, $valid)
18
    {
19
        $pattern = '~.*\/XYZ\/.*\.mov~';
20
21
        $file = new File();
22
        $file->setPath($path);
23
24
        $filter = new Path();
25
        $filter->setPattern($pattern);
26
        $this->assertEquals($valid, $filter->valid($file));
27
    }
28
29
    public function pathProvider()
30
    {
31
        return [
32
            ['/test/ABC/test.mov', false],
33
            ['/test/XYZ/test.mov', true],
34
            ['/test/XYZ/test.jpg', false],
35
        ];
36
    }
37
}
38