getColumnList()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace Hgraca\MicroDbal\Test\Crud\QueryBuilder\Sql;
4
5
use Hgraca\MicroDbal\Crud\QueryBuilder\Sql\CreateToken;
6
use Hgraca\MicroDbal\Crud\QueryBuilder\Sql\CreateTokenCollectionCollection;
7
use PHPUnit_Framework_TestCase;
8
9
final class CreateTokenCollectionCollectionUnitTest extends PHPUnit_Framework_TestCase
10
{
11
    /** @var array */
12
    private $dataSet = [
13
        [
14
            'id' => 1,
15
            'dummy_column_1' => 'some text',
16
            'dummy_column_2' => null,
17
        ],
18
        [
19
            'id' => 2,
20
            'dummy_column_1' => 'some other text',
21
            'dummy_column_2' => 7,
22
        ],
23
    ];
24
25
    /** @var CreateTokenCollectionCollection */
26
    private $createTokenCollection;
27
28
    /**
29
     * @before
30
     */
31
    public function setUpCollection()
32
    {
33
        $this->createTokenCollection = new CreateTokenCollectionCollection($this->dataSet);
34
    }
35
36
    /**
37
     * @test
38
     *
39
     * @small
40
     */
41
    public function getColumnList()
42
    {
43
        self::assertEquals(
44
            '(`id`, `dummy_column_1`, `dummy_column_2`)',
45
            $this->createTokenCollection->getColumnList()
46
        );
47
    }
48
49
    /**
50
     * @test
51
     *
52
     * @small
53
     */
54 View Code Duplication
    public function getPlaceholderList()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
55
    {
56
        self::assertEquals(
57
            '(' . CreateToken::BINDING_PREFIX . '0, ' . CreateToken::BINDING_PREFIX . '1, ' . CreateToken::BINDING_PREFIX . '2)',
58
            $this->createTokenCollection->getPlaceholderList()
59
        );
60
    }
61
62
    /**
63
     * @test
64
     *
65
     * @small
66
     */
67
    public function getBindingsList()
68
    {
69
        self::assertEquals(
70
            [
71
                [
72
                    ':c0' => 1,
73
                    ':c1' => 'some text',
74
                    ':c2' => null,
75
                ],
76
                [
77
                    ':c0' => 2,
78
                    ':c1' => 'some other text',
79
                    ':c2' => 7,
80
                ],
81
            ],
82
            $this->createTokenCollection->getBindingsList()
83
        );
84
    }
85
}
86