Completed
Push — master ( e77110...56a86b )
by Siad
16:13
created

ArgTest::testToStringJustValueWithQuotes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 7
rs 10
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
 * Test class for Arg.
22
 * Generated by PHPUnit on 2012-02-13 at 12:02:17.
23
 */
24
class ArgTest extends \PHPUnit\Framework\TestCase
25
{
26
    /**
27
     * @var Arg
28
     */
29
    protected $object;
30
31
    /**
32
     * Sets up the fixture, for example, opens a network connection.
33
     * This method is called before a test is executed.
34
     */
35
    protected function setUp(): void
36
    {
37
        $this->object = new Arg();
38
    }
39
40
    /**
41
     * Tears down the fixture, for example, closes a network connection.
42
     * This method is called after a test is executed.
43
     */
44
    protected function tearDown(): void
45
    {
46
    }
47
48
    /**
49
     * @covers Arg::getName
50
     * @covers Arg::setName
51
     */
52
    public function testSetGetName()
53
    {
54
        $o = $this->object;
55
        $o->setName('foo');
56
        $this->assertEquals('foo', $o->getName());
57
    }
58
59
    /**
60
     * @covers Arg::getValue
61
     * @covers Arg::setValue
62
     */
63
    public function testSetGetValue()
64
    {
65
        $o = $this->object;
66
        $o->setValue('foo');
67
        $this->assertEquals('foo', $o->getValue());
68
    }
69
70
    /**
71
     * @covers Arg::getQuotes
72
     * @covers Arg::setQuotes
73
     */
74
    public function testGetQuotes()
75
    {
76
        $o = $this->object;
77
        $o->setQuotes(true);
78
        $this->assertEquals(true, $o->getQuotes());
79
    }
80
81
    /**
82
     * @covers Arg::__toString
83
     */
84
    public function testToStringWithQuotes()
85
    {
86
        $o = $this->object;
87
        $o->setName('name');
88
        $o->setValue('value');
89
        $o->setQuotes(true);
90
91
        $this->assertEquals('--name="value"', '' . $o);
92
    }
93
94
    /**
95
     * @covers Arg::__toString
96
     */
97
    public function testToStringWithoutQuotes()
98
    {
99
        $o = $this->object;
100
        $o->setName('name');
101
        $o->setValue('value');
102
        $o->setQuotes(false);
103
104
        $this->assertEquals('--name=value', '' . $o);
105
    }
106
107
    /**
108
     * @covers Arg::__toString
109
     */
110
    public function testToStringJustName()
111
    {
112
        $o = $this->object;
113
        $o->setName('name');
114
        $o->setQuotes(false);
115
116
        $this->assertEquals('--name', '' . $o);
117
    }
118
119
    /**
120
     * @covers Arg::__toString
121
     */
122
    public function testToStringJustValueWithoutQuotes()
123
    {
124
        $o = $this->object;
125
        $o->setValue('value');
126
        $o->setQuotes(false);
127
128
        $this->assertEquals('value', '' . $o);
129
    }
130
131
    /**
132
     * @covers Arg::__toString
133
     */
134
    public function testToStringJustValueWithQuotes()
135
    {
136
        $o = $this->object;
137
        $o->setValue('value');
138
        $o->setQuotes(true);
139
140
        $this->assertEquals('"value"', '' . $o);
141
    }
142
}
143