Passed
Push — master ( 345c9b...faecaf )
by Michiel
20:58
created

PatternSetTest   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 22
c 1
b 0
f 0
dl 0
loc 62
rs 10
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A testIfReferencesSetThenCreatIncludesFileThrowsException() 0 6 1
A setUp() 0 3 1
A testIfReferenceSetThenCreateIncludeThrowsException() 0 6 1
A testIfReferencesSetThenCreatExcludesFileThrowsException() 0 6 1
A testBothEmpty() 0 5 1
A testIfReferenceSetThenCreateExcludeThrowsException() 0 6 1
1
<?php
2
class PatternSetTest extends \PHPUnit\Framework\TestCase
3
{
4
    private $patternset;
5
6
    protected function setUp(): void
7
    {
8
        $this->patternset = new PatternSet();
9
    }
10
11
    public function testBothEmpty()
12
    {
13
        $s = "" . $this->patternset;
14
        $this->assertEquals($s, "patternSet{ includes: empty  excludes: empty }");
15
        $this->assertEquals(false, $this->patternset->hasPatterns());
16
    }
17
18
    /**
19
     * @expectedException BuildException
20
     * @expectedExceptionMessage You must not specify nested elements when using refid
21
     */
22
    public function testIfReferenceSetThenCreateIncludeThrowsException()
23
    {
24
        $project = new Project();
25
        $reference = new Reference($project);
26
        $this->patternset->setRefId($reference);
27
        $this->patternset->createInclude();
28
    }
29
30
    /**
31
     * @expectedException BuildException
32
     * @expectedExceptionMessage You must not specify nested elements when using refid
33
     */
34
    public function testIfReferenceSetThenCreateExcludeThrowsException()
35
    {
36
        $project = new Project();
37
        $reference = new Reference($project);
38
        $this->patternset->setRefId($reference);
39
        $this->patternset->createExclude();
40
    }
41
42
    /**
43
     * @expectedException BuildException
44
     * @expectedExceptionMessage You must not specify nested elements when using refid
45
     */
46
    public function testIfReferencesSetThenCreatExcludesFileThrowsException()
47
    {
48
        $project = new Project();
49
        $reference = new Reference($project);
50
        $this->patternset->setRefId($reference);
51
        $this->patternset->createExcludesFile();
52
    }
53
54
    /**
55
     * @expectedException BuildException
56
     * @expectedExceptionMessage You must not specify nested elements when using refid
57
     */
58
    public function testIfReferencesSetThenCreatIncludesFileThrowsException()
59
    {
60
        $project = new Project();
61
        $reference = new Reference($project);
62
        $this->patternset->setRefId($reference);
63
        $this->patternset->createIncludesFile();
64
    }
65
66
}
67