|
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
|
|
|
|