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
|
|
|
* UTs for ExtensionPoint component |
22
|
|
|
* |
23
|
|
|
* @author Siad Ardroumli <[email protected]> |
24
|
|
|
* @package phing.system |
25
|
|
|
*/ |
26
|
|
|
class ExtensionPointTest extends BuildFileTest |
27
|
|
|
{ |
28
|
|
|
public function setUp(): void |
29
|
|
|
{ |
30
|
|
|
$this->configureProject( |
31
|
|
|
PHING_TEST_BASE |
32
|
|
|
. "/etc/components/ExtensionPoint/ExtensionPoint.xml" |
33
|
|
|
); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
public function testExtensionPointWorksLikeTarget() |
37
|
|
|
{ |
38
|
|
|
$this->expectLogContaining(__FUNCTION__, 'foobar'); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
public function testAddToExtensionPoint() |
42
|
|
|
{ |
43
|
|
|
$this->expectLogContaining(__FUNCTION__, 'In target bar'); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
public function testExtensionPointMustBeEmpty() |
47
|
|
|
{ |
48
|
|
|
try { |
49
|
|
|
$this->executeTarget(__FUNCTION__); |
50
|
|
|
} catch (BuildException $e) { |
51
|
|
|
$this->assertInLogs('you must not nest child elements into an extension-point'); |
52
|
|
|
} |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
public function testCantAddToPlainTarget() |
56
|
|
|
{ |
57
|
|
|
$this->expectBuildException(__FUNCTION__, 'referenced target foo is not an extension-point'); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
public function testExtensionPointInImportedBuildfile() |
61
|
|
|
{ |
62
|
|
|
$this->expectLogContaining(__FUNCTION__, 'in target prepare'); |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
public function testExtensionPointInImportedBuildfileWithNestedImport() |
66
|
|
|
{ |
67
|
|
|
$this->expectLogContaining(__FUNCTION__, 'in compile java'); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
public function testMissingExtensionPointCausesError() |
71
|
|
|
{ |
72
|
|
|
$this->expectBuildException(__FUNCTION__, 'can\'t add target bar to extension-point foo because the extension-point is unknown'); |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
public function testMissingExtensionPointCausesWarningWhenConfigured() |
76
|
|
|
{ |
77
|
|
|
$this->executeTarget(__FUNCTION__); |
78
|
|
|
$this->assertInLogs('can\'t add target bar to extension-point foo because the extension-point is unknown', Project::MSG_WARN); |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
public function testMissingExtensionPointIgnoredWhenConfigured() |
82
|
|
|
{ |
83
|
|
|
$this->executeTarget(__FUNCTION__); |
84
|
|
|
$this->assertNotInLogs('can\'t add target bar to extension-point foo because the extension-point is unknown', Project::MSG_WARN); |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
public function testOnlyAllowsExtensionPointMissingAttributeWhenExtensionOfPresent() |
88
|
|
|
{ |
89
|
|
|
$this->expectBuildException(__FUNCTION__, 'onMissingExtensionPoint attribute cannot be specified unless extensionOf is specified'); |
90
|
|
|
} |
91
|
|
|
} |
92
|
|
|
|