Completed
Push — master ( da3759...8e04a1 )
by Gerrit
02:15
created

LiteralArgumentFactoryTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 40
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A understandsAllTheThings() 0 7 1
A shouldCreateArgumentFromString() 0 9 1
A shouldCreateArgumentFromArray() 0 8 1
1
<?php
2
/**
3
 * Copyright (C) 2017  Gerrit Addiks.
4
 * This package (including this file) was released under the terms of the GPL-3.0.
5
 * You should have received a copy of the GNU General Public License along with this program.
6
 * If not, see <http://www.gnu.org/licenses/> or send me a mail so i can send you a copy.
7
 * @license GPL-3.0
8
 * @author Gerrit Addiks <[email protected]>
9
 */
10
11
namespace Addiks\SymfonyGenerics\Tests\Unit\Arguments\ArgumentFactory;
12
13
use PHPUnit\Framework\TestCase;
14
use Addiks\SymfonyGenerics\Arguments\ArgumentFactory\LiteralArgumentFactory;
15
use Addiks\SymfonyGenerics\Arguments\LiteralArgument;
16
17
final class LiteralArgumentFactoryTest extends TestCase
18
{
19
20
    /**
21
     * @test
22
     */
23
    public function understandsAllTheThings()
24
    {
25
        $factory = new LiteralArgumentFactory();
26
27
        $this->assertTrue($factory->understandsString("foo"));
28
        $this->assertTrue($factory->understandsArray([]));
29
    }
30
31
    /**
32
     * @test
33
     */
34
    public function shouldCreateArgumentFromString()
35
    {
36
        $factory = new LiteralArgumentFactory();
37
38
        $this->assertEquals(new LiteralArgument('foo'), $factory->createArgumentFromString("foo"));
39
        $this->assertEquals(new LiteralArgument('bar'), $factory->createArgumentFromString("bar"));
40
        $this->assertEquals(new LiteralArgument('foo'), $factory->createArgumentFromString('"foo"'));
41
        $this->assertEquals(new LiteralArgument('bar'), $factory->createArgumentFromString("'bar'"));
42
    }
43
44
    /**
45
     * @test
46
     */
47
    public function shouldCreateArgumentFromArray()
48
    {
49
        $this->assertEquals(
50
            new LiteralArgument(['foo']),
51
            (new LiteralArgumentFactory())->createArgumentFromArray(["foo"])
52
        );
53
54
    }
55
56
}
57