Completed
Push — master ( b2adab...2f2f8c )
by Siad
12:43
created

ConditionTaskTest   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 21
dl 0
loc 60
rs 10
c 0
b 0
f 0
wmc 9

9 Methods

Rating   Name   Duplication   Size   Complexity  
A testContains() 0 4 1
A setUp() 0 4 1
A testEquals() 0 4 1
A testCustomCondition() 0 4 1
A testReferenceExists() 0 4 1
A testMatches() 0 4 1
A testSocketCondition() 0 4 1
A testIsTrue() 0 5 1
A testZero() 0 5 1
1
<?php
2
/**
3
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
5
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
6
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
12
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
13
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14
 *
15
 * This software consists of voluntary contributions made by many individuals
16
 * and is licensed under the LGPL. For more information please see
17
 * <http://phing.info>.
18
 */
19
20
/**
21
 * Tests the Condition Task
22
 *
23
 * @author  Michiel Rook <[email protected]>
24
 * @package phing.tasks.system
25
 */
26
class ConditionTaskTest extends BuildFileTest
27
{
28
    public function setUp(): void
29
    {
30
        $this->configureProject(
31
            PHING_TEST_BASE . '/etc/tasks/system/ConditionTest.xml'
32
        );
33
    }
34
35
    public function testEquals()
36
    {
37
        $this->executeTarget(__FUNCTION__);
38
        $this->assertPropertySet('isEquals');
39
    }
40
41
    public function testContains()
42
    {
43
        $this->executeTarget(__FUNCTION__);
44
        $this->assertPropertySet('isContains');
45
    }
46
47
    public function testCustomCondition()
48
    {
49
        $this->executeTarget(__FUNCTION__);
50
        $this->assertPropertySet('isCustom');
51
    }
52
53
    public function testReferenceExists()
54
    {
55
        $this->executeTarget(__FUNCTION__);
56
        $this->assertPropertyUnset('ref.exists');
57
    }
58
59
    /**
60
     * @requires extension sockets
61
     */
62
    public function testSocketCondition()
63
    {
64
        $this->executeTarget(__FUNCTION__);
65
        $this->assertPropertyUnset('socket');
66
    }
67
68
    public function testMatches()
69
    {
70
        $this->executeTarget(__FUNCTION__);
71
        $this->assertPropertyEquals('matches', 'true');
72
    }
73
74
    public function testIsTrue()
75
    {
76
        $this->executeTarget(__FUNCTION__);
77
        $this->assertPropertyEquals('istrueEqOne', 'true');
78
        $this->assertPropertyEquals('istrueEqEleven', 'true');
79
    }
80
81
    public function testZero()
82
    {
83
        $this->executeTarget(__FUNCTION__);
84
        $this->assertPropertyEquals('zero', '0');
85
        $this->assertPropertyEquals('one', '1');
86
    }
87
}
88