Passed
Push — master ( 972120...1c77fc )
by Michiel
08:19
created

AvailableTaskTest   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 18
dl 0
loc 50
rs 10
c 0
b 0
f 0
wmc 8

8 Methods

Rating   Name   Duplication   Size   Complexity  
A tearDown() 0 3 1
A setUp() 0 7 1
A testDanglingSymlink() 0 4 1
A testDirectoryAbsoluteSymlink() 0 4 1
A testDirectorySymlinkBC() 0 4 1
A testDirectorySymlink() 0 4 1
A testFileSymlink() 0 4 1
A testFileAbsoluteSymlink() 0 4 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
namespace Phing\Tasks\System;
21
22
use Phing\Support\BuildFileTest;
23
24
/**
25
 * Tests the Available Task
26
 *
27
 * @author  Michiel Rook <[email protected]>
28
 * @package phing.tasks.system
29
 *
30
 * TODO: fix these tests on windows. Windows symlink command is mklink. I am not sure why these tests
31
 *       are throwing errors.
32
 * @requires OS ^(?:(?!Win).)*$
33
 */
34
class AvailableTaskTest extends BuildFileTest
35
{
36
    public function setUp(): void
37
    {
38
        $this->configureProject(
39
            PHING_TEST_BASE
40
            . "/etc/tasks/system/AvailableTaskTest.xml"
41
        );
42
        $this->executeTarget("setup");
43
    }
44
45
    public function tearDown(): void
46
    {
47
        $this->executeTarget("clean");
48
    }
49
50
    public function testDanglingSymlink()
51
    {
52
        $this->executeTarget(__FUNCTION__);
53
        $this->assertNull($this->project->getProperty("prop." . __FUNCTION__));
54
    }
55
56
    public function testFileSymlink()
57
    {
58
        $this->executeTarget(__FUNCTION__);
59
        $this->assertEquals('true', $this->project->getProperty("prop." . __FUNCTION__));
60
    }
61
62
    public function testFileAbsoluteSymlink()
63
    {
64
        $this->executeTarget(__FUNCTION__);
65
        $this->assertEquals('true', $this->project->getProperty("prop." . __FUNCTION__));
66
    }
67
68
    public function testDirectorySymlink()
69
    {
70
        $this->executeTarget(__FUNCTION__);
71
        $this->assertEquals('true', $this->project->getProperty("prop." . __FUNCTION__));
72
    }
73
74
    public function testDirectoryAbsoluteSymlink()
75
    {
76
        $this->executeTarget(__FUNCTION__);
77
        $this->assertEquals('true', $this->project->getProperty("prop." . __FUNCTION__));
78
    }
79
80
    public function testDirectorySymlinkBC()
81
    {
82
        $this->executeTarget(__FUNCTION__);
83
        $this->assertNull($this->project->getProperty("prop." . __FUNCTION__));
84
    }
85
}
86