Skip to content

Commit 512db63

Browse files
committed
Add a test for #299
Signed-off-by: William Desportes <[email protected]>
1 parent ce56f16 commit 512db63

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

tests/Components/CreateDefinitionTest.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,38 @@ public function testBuild2()
9292
);
9393
}
9494

95+
public function testBuild3()
96+
{
97+
$parser = new Parser(
98+
'DROP TABLE IF EXISTS `searches`;'
99+
. 'CREATE TABLE `searches` ('
100+
. ' `id` int(10) unsigned NOT NULL AUTO_INCREMENT,'
101+
. ' `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,'
102+
. ' `public_name` varchar(120) COLLATE utf8_unicode_ci NOT NULL,'
103+
. ' `group_id` smallint(5) unsigned NOT NULL DEFAULT \'0\','
104+
. ' `shortdesc` tinytext COLLATE utf8_unicode_ci,'
105+
. ' `show_separators` tinyint(1) NOT NULL DEFAULT \'0\','
106+
. ' `show_separators_two` tinyint(1) NOT NULL DEFAULT FALSE,'
107+
. ' `deleted` tinyint(1) NOT NULL DEFAULT \'0\','
108+
. ' PRIMARY KEY (`id`)'
109+
. ') ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ;'
110+
. ''
111+
. 'ALTER TABLE `searches` ADD `admins_only` BOOLEAN NOT NULL DEFAULT FALSE AFTER `show_separators`;'
112+
);
113+
$this->assertEquals(
114+
'`public_name` varchar(120) COLLATE utf8_unicode_ci NOT NULL',
115+
CreateDefinition::build($parser->statements[1]->fields[2])
116+
);
117+
$this->assertEquals(
118+
'`show_separators` tinyint(1) NOT NULL DEFAULT \'0\'',
119+
CreateDefinition::build($parser->statements[1]->fields[5])
120+
);
121+
$this->assertEquals(
122+
'`show_separators_two` tinyint(1) NOT NULL DEFAULT FALSE',
123+
CreateDefinition::build($parser->statements[1]->fields[6])
124+
);
125+
}
126+
95127
public function testBuildWithInvisibleKeyword()
96128
{
97129
$parser = new Parser(

0 commit comments

Comments
 (0)