Skip to content

Commit 7b23d24

Browse files
committed
test some simple table props end-to-end
1 parent 9dde640 commit 7b23d24

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/TablePropsTest.php

+22
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,26 @@ function testTwoWordProps(){
4747

4848

4949
# TODO: case conversion, multiple options, optional commas
50+
51+
52+
function get_first_table($str){
53+
$obj = new iamcal\SQLParser();
54+
$obj->parse($str);
55+
56+
$tables = array_keys($obj->tables);
57+
$first_key = $tables[0];
58+
59+
return $obj->tables[$first_key];
60+
}
61+
62+
function testGeneralCreation(){
63+
64+
$tbl = $this->get_first_table("CREATE TABLE foo");
65+
$this->assertEquals($tbl['name'], "foo");
66+
$this->assertEquals(array_key_exists('temporary', $tbl['props']), false);
67+
68+
$tbl = $this->get_first_table("CREATE TEMPORARY TABLE foo");
69+
$this->assertEquals($tbl['name'], "foo");
70+
$this->assertEquals($tbl['props']['temporary'], true);
71+
}
5072
}

0 commit comments

Comments
 (0)