Passed
Pull Request — master (#311)
by William
12:43
created

TransactionStatementTest::testBuilder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 12
c 2
b 0
f 0
nc 1
nop 0
dl 0
loc 16
rs 9.8666
1
<?php
2
3
namespace PhpMyAdmin\SqlParser\Tests\Builder;
4
5
use PhpMyAdmin\SqlParser\Parser;
6
use PhpMyAdmin\SqlParser\Tests\TestCase;
7
8
class TransactionStatementTest extends TestCase
9
{
10
    public function testBuilder()
11
    {
12
        $query = 'START TRANSACTION;' .
13
            'SELECT @A:=SUM(salary) FROM table1 WHERE type=1;' .
14
            'UPDATE table2 SET summary=@A WHERE type=1;' .
15
            'COMMIT;';
16
17
        $parser = new Parser($query);
18
        $stmt = $parser->statements[0];
19
20
        $this->assertEquals(
21
            'START TRANSACTION;' .
22
            'SELECT @A:=SUM(salary) FROM table1 WHERE type=1;' .
23
            'UPDATE table2 SET summary = @A WHERE type=1;' .
24
            'COMMIT',
25
            $stmt->build()
26
        );
27
    }
28
}
29