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

TstampTaskTest   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 18
dl 0
loc 45
rs 10
c 0
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A testMagicPropertyBoth() 0 4 1
A setUp() 0 8 1
A testPrefix() 0 6 1
A testMagicPropertyIsoCustomFormat() 0 4 1
A testMagicPropertyIso() 0 4 1
A testMagicProperty() 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
use Phing\Tasks\System\TstampTask;
24
25
/**
26
 * Tests the Tstamp Task
27
 *
28
 * @author  Siad Ardroumli <[email protected]>
29
 * @package phing.tasks.system
30
 */
31
class TstampTaskTest extends BuildFileTest
32
{
33
    /** @var TstampTask */
34
    private $tstamp;
35
36
    public function setUp(): void
37
    {
38
        $this->configureProject(
39
            PHING_TEST_BASE . '/etc/tasks/system/TstampTest.xml'
40
        );
41
42
        $this->tstamp = new TstampTask();
43
        $this->tstamp->setProject($this->project);
44
    }
45
46
    public function testMagicProperty()
47
    {
48
        $this->executeTarget(__FUNCTION__);
49
        $this->assertPropertyEquals('DSTAMP', 19700102);
50
    }
51
52
    public function testMagicPropertyIso()
53
    {
54
        $this->executeTarget(__FUNCTION__);
55
        $this->assertPropertyEquals('DSTAMP', 19720417);
56
    }
57
58
    public function testMagicPropertyBoth()
59
    {
60
        $this->executeTarget(__FUNCTION__);
61
        $this->assertPropertyEquals('DSTAMP', 19720417);
62
    }
63
64
    public function testMagicPropertyIsoCustomFormat()
65
    {
66
        $this->executeTarget(__FUNCTION__);
67
        $this->assertPropertyEquals('tstamp.test', '1972-04-17');
68
    }
69
70
    public function testPrefix()
71
    {
72
        $this->tstamp->setPrefix('prefix');
73
        $this->tstamp->main();
74
        $prop = $this->project->getProperty('prefix.DSTAMP');
75
        $this->assertNotNull($prop);
76
    }
77
}
78