|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Tests the AugmentReference Task |
|
5
|
|
|
* |
|
6
|
|
|
* @author Siad Ardroumli <[email protected]> |
|
7
|
|
|
* @package phing.tasks.system |
|
8
|
|
|
*/ |
|
9
|
|
|
class AugmentTest extends BuildFileTest |
|
10
|
|
|
{ |
|
11
|
|
|
public function setUp(): void |
|
12
|
|
|
{ |
|
13
|
|
|
$this->configureProject( |
|
14
|
|
|
PHING_TEST_BASE . '/etc/tasks/system/AugmentTest.xml' |
|
15
|
|
|
); |
|
16
|
|
|
$this->executeTarget(__FUNCTION__); |
|
17
|
|
|
/** @var FileSet $fs */ |
|
18
|
|
|
$fs = $this->getProject()->getReference('input-fs'); |
|
19
|
|
|
$this->assertEquals(3, $fs->getIterator()->count()); |
|
20
|
|
|
} |
|
21
|
|
|
|
|
22
|
|
|
public function tearDown(): void |
|
23
|
|
|
{ |
|
24
|
|
|
$this->executeTarget(__FUNCTION__); |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
public function testAugmentAttribute() |
|
28
|
|
|
{ |
|
29
|
|
|
$this->executeTarget(__FUNCTION__); |
|
30
|
|
|
$this->assertEquals(2, $this->getProject()->getReference('input-fs')->getIterator()->count()); |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
public function testAugmentElement() |
|
34
|
|
|
{ |
|
35
|
|
|
$this->executeTarget(__FUNCTION__); |
|
36
|
|
|
$this->assertEquals(1, $this->getProject()->getReference('input-fs')->getIterator()->count()); |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
public function testNoref() |
|
40
|
|
|
{ |
|
41
|
|
|
$this->expectSpecificBuildException( |
|
42
|
|
|
__FUNCTION__, |
|
43
|
|
|
'an unknown reference was found.', |
|
44
|
|
|
'Unknown reference "nosuchreference"' |
|
45
|
|
|
); |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
public function testIdNotSet() |
|
49
|
|
|
{ |
|
50
|
|
|
$this->expectSpecificBuildException( |
|
51
|
|
|
__FUNCTION__, |
|
52
|
|
|
"the augment attribute 'id' is set.", |
|
53
|
|
|
"augment attribute 'id' unset" |
|
54
|
|
|
); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
public function testIllegalAttribute() |
|
58
|
|
|
{ |
|
59
|
|
|
$this->expectSpecificBuildException( |
|
60
|
|
|
__FUNCTION__, |
|
61
|
|
|
'it does support unsupported attribute', |
|
62
|
|
|
"phing.types.FileSet doesn't support the 'filesetwillmostlikelyneversupportthisattribute' attribute." |
|
63
|
|
|
); |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
public function testIllegalElement() |
|
67
|
|
|
{ |
|
68
|
|
|
$this->expectSpecificBuildException( |
|
69
|
|
|
__FUNCTION__, |
|
70
|
|
|
'it does support unsupported element', |
|
71
|
|
|
"phing.types.FileSet doesn't support the 'filesetwillmostlikelyneversupportthiselement' creator/adder." |
|
72
|
|
|
); |
|
73
|
|
|
} |
|
74
|
|
|
} |
|
75
|
|
|
|