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

testParseNameWithUnderscore()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 7
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 10
rs 10
1
<?php
2
3
namespace PhpMyAdmin\SqlParser\Tests\Components;
4
5
use PhpMyAdmin\SqlParser\Components\PartitionDefinition;
6
use PhpMyAdmin\SqlParser\Parser;
7
use PhpMyAdmin\SqlParser\Tests\TestCase;
8
9
class PartitionDefinitionTest extends TestCase
10
{
11
    public function testParse()
12
    {
13
        $component = PartitionDefinition::parse(
14
            new Parser(),
15
            $this->getTokensList('PARTITION p0 VALUES LESS THAN(1990)')
16
        );
17
        $this->assertFalse($component->isSubpartition);
18
        $this->assertEquals('p0', $component->name);
19
        $this->assertEquals('LESS THAN', $component->type);
20
        $this->assertEquals('(1990)', $component->expr->expr);
21
    }
22
23
    public function testParseNameWithUnderscore()
24
    {
25
        $component = PartitionDefinition::parse(
26
            new Parser(),
27
            $this->getTokensList('PARTITION 2017_12 VALUES LESS THAN (\'2018-01-01 00:00:00\') ENGINE = MyISAM')
28
        );
29
        $this->assertFalse($component->isSubpartition);
30
        $this->assertEquals('2017_12', $component->name);
31
        $this->assertEquals('LESS THAN', $component->type);
32
        $this->assertEquals('(\'2018-01-01 00:00:00\')', $component->expr->expr);
33
    }
34
}
35