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