Test Failed
Push — master ( 7d28e2...923481 )
by Gerrit
02:21
created

ParseSqlTest::shouldParseSomeSql()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 3
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 17
rs 10
1
<?php
2
/**
3
 * Copyright (C) 2019  Gerrit Addiks.
4
 * This package (including this file) was released under the terms of the GPL-3.0.
5
 * You should have received a copy of the GNU General Public License along with this program.
6
 * If not, see <http://www.gnu.org/licenses/> or send me a mail so i can send you a copy.
7
 * @license GPL-3.0
8
 * @author Gerrit Addiks <[email protected]>
9
 */
10
11
namespace Addiks;
12
13
use PHPUnit\Framework\TestCase;
14
use Addiks\StoredSQL\Parsing\SqlParserClass;
15
use Addiks\StoredSQL\Parsing\SqlParser;
16
use Addiks\StoredSQL\Parsing\AbstractSyntaxTree\SqlAstNode;
17
18
final class ParseSqlTest extends TestCase
19
{
20
21
    /** @test */
22
    public function shouldParseSomeSql(): void
23
    {
24
        /** @var SqlParser $parser */
25
        $parser = SqlParserClass::defaultParser();
26
27
        /** @var array<SqlAstNode> $detectedContent */
28
        $detectedContent = $parser->parseSql("
29
            SELECT u.name, u.email, f.name, f.size
30
            FROM users u
31
            LEFT JOIN files f ON(u.id = f.owner_id)
32
            WHERE f.name LIKE '%.pdf'
33
            AND f.type = 'symbolic'
34
            OR f.foo IS NULL
35
            ORDER BY f.size DESC
36
        ");
37
38
        var_dump($detectedContent);
0 ignored issues
show
Security Debugging Code introduced by
var_dump($detectedContent) looks like debug code. Are you sure you do not want to remove it?
Loading history...
39
    }
40
41
}
42