Skip to content

Commit

Permalink
add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
kojirock5260 committed Apr 14, 2021
1 parent 62f12d0 commit 17102a6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tests/CreateTableParseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function testSimpleParse()

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

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

foreach ($create_queries as $create_query) {
$table = \Vimeo\MysqlEngine\Processor\CreateProcessor::makeTableDefinition(
Expand Down
14 changes: 12 additions & 2 deletions tests/fixtures/create_table.sql
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ CREATE TABLE `video_game_characters` (
`nullable_field_default_0` tinyint(3) DEFAULT '0',
`some_float` float DEFAULT '0.00',
`total_games` int(11) UNSIGNED NOT NULL DEFAULT '0',
`lives` int(11) UNSIGNED NOT NULL DEFAULT 0,
`lives` int(11) UNSIGNED NOT NULL DEFAULT '0',
`created_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`modified_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`deleted_on` timestamp NULL DEFAULT NULL,
Expand Down Expand Up @@ -50,4 +50,14 @@ CREATE TABLE `transactions` (
`other_tax` DECIMAL(12, 2) DEFAULT NULL,
PRIMARY KEY (`id`)
)
ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

CREATE TABLE `orders`
(
`id` INTEGER(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`user_id` INTEGER(11) UNSIGNED,
`price` INTEGER(11) UNSIGNED NOT NULL DEFAULT 0,
`created_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`modified_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

0 comments on commit 17102a6

Please sign in to comment.