Passed
Push — master ( 77c655...406288 )
by Siad
10:48
created

PathConvertTest::assertTarget()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
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 Apply Task
22
 *
23
 * @author  Siad Ardroumli <[email protected]>
24
 * @package phing.tasks.system
25
 */
26
class PathConvertTest extends BuildFileTest
27
{
28
    /**
29
     * Setup the test
30
     */
31
    public function setUp(): void
32
    {
33
        // Tests definitions
34
        $this->configureProject(PHING_TEST_BASE . '/etc/tasks/system/PathConvertTest.xml');
35
    }
36
37
    /**
38
     * Tests the OS execution for the unspecified OS
39
     */
40
    public function testDirChar()
41
    {
42
        $this->executeTarget(__FUNCTION__);
43
        $this->assertPropertyEquals('def|ghi', 'def|ghi');
44
    }
45
46
    public function testMap()
47
    {
48
        $this->assertTarget('testmap');
49
    }
50
51
    public function testMapper()
52
    {
53
        $this->assertTarget('testmapper');
54
    }
55
56
    public function testUnique()
57
    {
58
        $p = new Path($this->project, '/a:/a');
59
        $p->setPath("\\a;/a");
60
        $l = $p->listPaths();
61
        $this->assertCount(1, $l, "1 after setPath");
62
        $p->append(new Path($this->project, "/a;\\a:\\a"));
63
        $l = $p->listPaths();
64
        $this->assertCount(1, $l, "1 after append");
65
        $p->createPath()->setPath("\\a:/a");
66
        $l = $p->listPaths();
67
        $this->assertCount(1, $l, "1 after append");
68
        $l = $p->listPaths(true);
69
        $this->assertCount(6, $l, "6 after preserved duplicates");
70
    }
71
72
    public function testNoTargetOs()
73
    {
74
        $this->executeTarget('testnotargetos');
75
    }
76
77
    private function assertTarget(string $target)
78
    {
79
        $this->executeTarget($target);
80
        $this->assertEquals("test#" . 'PathConvertTest.xml', $this->getProject()->getProperty('result'));
81
    }
82
}
83