Passed
Push — main ( 436d8c...f01a67 )
by Peter
02:36
created

TableTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 15
dl 0
loc 34
rs 10
c 1
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testToStringWithoutAlias() 0 10 1
A testToStringWithAlias() 0 11 1
A testGetParam() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace QB\Generic\Clause;
6
7
use PHPUnit\Framework\TestCase;
8
9
class TableTest extends TestCase
10
{
11
    public function testToStringWithoutAlias()
12
    {
13
        $tableName = 'foo';
14
15
        $sut = new Table($tableName);
16
17
        $expectedSql = $tableName;
18
        $actualSql   = (string)$sut;
19
20
        $this->assertSame($expectedSql, $actualSql);
21
    }
22
23
    public function testToStringWithAlias()
24
    {
25
        $tableName = 'foo';
26
        $alias     = 'f';
27
28
        $sut = new Table($tableName, $alias);
29
30
        $expectedSql = sprintf('%s AS %s', $tableName, $alias);
31
        $actualSql   = (string)$sut;
32
33
        $this->assertSame($expectedSql, $actualSql);
34
    }
35
36
    public function testGetParam()
37
    {
38
        $sut = new Table('foo', 'f');
39
40
        $actualParams = $sut->getParams();
41
42
        $this->assertSame([], $actualParams);
43
    }
44
}
45