Passed
Push — main ( 5e0bcd...9ce40a )
by Peter
02:12
created

SuperExprTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 29
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A createSut() 0 3 1
A testIn() 0 15 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace QB\Generic\Expr;
6
7
class SuperExprTest extends ExprTest
8
{
9
10
    public function testIn()
11
    {
12
        $expectedSql = 'col IN (?, ?, ?)';
13
        $expectedParams = [['col', \PDO::PARAM_STR], [8, \PDO::PARAM_STR], [6, \PDO::PARAM_INT]];
14
15
        $sql    = 'col IN (??)';
16
        $params = [[['col', \PDO::PARAM_STR], 8, [6, \PDO::PARAM_INT]]];
17
18
        $sut = $this->createSut($sql, $params);
19
20
        $actualSql    = $sut->__toString();
21
        $actualParams = $sut->getParams();
22
23
        $this->assertSame($expectedSql, $actualSql);
24
        $this->assertSame($expectedParams, $actualParams);
25
    }
26
27
    /**
28
     * @param string $sql
29
     * @param array  $params
30
     *
31
     * @return Expr
32
     */
33
    protected function createSut(string $sql, array $params = []): Expr
34
    {
35
        return new SuperExpr($sql, $params);
36
    }
37
}
38