Passed
Push — master ( d68b8d...e5c614 )
by Siad
10:45
created

AugmentTest   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 27
c 1
b 0
f 0
dl 0
loc 63
rs 10
wmc 8

8 Methods

Rating   Name   Duplication   Size   Complexity  
A testIdNotSet() 0 6 1
A testAugmentAttribute() 0 4 1
A testNoref() 0 6 1
A testIllegalElement() 0 6 1
A testAugmentElement() 0 4 1
A testIllegalAttribute() 0 6 1
A setUp() 0 9 1
A tearDown() 0 3 1
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