Total Complexity | 3 |
Total Lines | 41 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | class InsertTest extends TestCase |
||
10 | { |
||
11 | public function testInsertSimple() |
||
22 | } |
||
23 | |||
24 | public function testComplex() |
||
25 | { |
||
26 | $sql = (string)$this->getSut('foo') |
||
27 | ->addModifier('BAR') |
||
28 | ->addColumns('id', 'bar_id', 'baz') |
||
29 | ->addValues('1234', '2345', 'a') |
||
30 | ->addValues('3456', '4567', 'b'); |
||
31 | |||
32 | $parts = []; |
||
33 | $parts[] = 'INSERT BAR INTO foo (id, bar_id, baz)'; |
||
34 | $parts[] = 'VALUES (?, ?, ?),'; |
||
35 | $parts[] = '(?, ?, ?)'; |
||
36 | |||
37 | $expectedSql = implode(PHP_EOL, $parts); |
||
38 | |||
39 | $this->assertSame($expectedSql, $sql); |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * @param string $table |
||
44 | * |
||
45 | * @return IInsert |
||
46 | */ |
||
47 | protected function getSut(string $table): IInsert |
||
50 | } |
||
51 | } |
||
52 |