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

PathTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 26
c 0
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testFilter() 0 11 1
A pathProvider() 0 8 1
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