Skip to content

Commit 17102a6

Browse files
committed
add test case
1 parent 62f12d0 commit 17102a6

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

tests/CreateTableParseTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function testSimpleParse()
1414

1515
$create_queries = (new \Vimeo\MysqlEngine\Parser\CreateTableParser)->parse($query);
1616

17-
$this->assertCount(4, $create_queries);
17+
$this->assertCount(5, $create_queries);
1818

1919
foreach ($create_queries as $create_query) {
2020
$table = \Vimeo\MysqlEngine\Processor\CreateProcessor::makeTableDefinition(

tests/fixtures/create_table.sql

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ CREATE TABLE `video_game_characters` (
1313
`nullable_field_default_0` tinyint(3) DEFAULT '0',
1414
`some_float` float DEFAULT '0.00',
1515
`total_games` int(11) UNSIGNED NOT NULL DEFAULT '0',
16-
`lives` int(11) UNSIGNED NOT NULL DEFAULT 0,
16+
`lives` int(11) UNSIGNED NOT NULL DEFAULT '0',
1717
`created_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
1818
`modified_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
1919
`deleted_on` timestamp NULL DEFAULT NULL,
@@ -50,4 +50,14 @@ CREATE TABLE `transactions` (
5050
`other_tax` DECIMAL(12, 2) DEFAULT NULL,
5151
PRIMARY KEY (`id`)
5252
)
53-
ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
53+
ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
54+
55+
CREATE TABLE `orders`
56+
(
57+
`id` INTEGER(11) UNSIGNED NOT NULL AUTO_INCREMENT,
58+
`user_id` INTEGER(11) UNSIGNED,
59+
`price` INTEGER(11) UNSIGNED NOT NULL DEFAULT 0,
60+
`created_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
61+
`modified_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
62+
PRIMARY KEY (`id`)
63+
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

0 commit comments

Comments
 (0)