Best Prophecy code snippet using or.getMethodName
ColumnTokenizerTest.php
Source:ColumnTokenizerTest.php
...10 $columnTokenizer = ColumnTokenizer::parse('`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL');11 $columnDefinition = $columnTokenizer->definition();12 $this->assertEquals('email', $columnDefinition->getColumnName());13 $this->assertEquals('varchar', $columnTokenizer->getColumnDataType());14 $this->assertEquals('string', $columnDefinition->getMethodName());15 $this->assertCount(0, $columnDefinition->getMethodParameters());16 $this->assertFalse($columnDefinition->isNullable());17 $this->assertEquals('utf8mb4_unicode_ci', $columnDefinition->getCollation());18 $this->assertEquals('$table->string(\'email\')', $columnDefinition->render());19 }20 public function test_it_tokenizes_a_null_varchar_column()21 {22 $columnTokenizer = ColumnTokenizer::parse('`favorite_color` varchar(200) COLLATE utf8mb4_unicode_ci');23 $columnDefinition = $columnTokenizer->definition();24 $this->assertEquals('favorite_color', $columnDefinition->getColumnName());25 $this->assertEquals('varchar', $columnTokenizer->getColumnDataType());26 $this->assertEquals('string', $columnDefinition->getMethodName());27 $this->assertEquals(200, $columnDefinition->getMethodParameters()[0]);28 $this->assertTrue($columnDefinition->isNullable());29 $this->assertEquals('utf8mb4_unicode_ci', $columnDefinition->getCollation());30 $this->assertEquals('$table->string(\'favorite_color\', 200)->nullable()', $columnDefinition->render());31 }32 public function test_it_tokenizes_a_null_varchar_default_value_column()33 {34 $columnTokenizer = ColumnTokenizer::parse('`favorite_color` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT \'orange\'');35 $columnDefinition = $columnTokenizer->definition();36 $this->assertEquals('favorite_color', $columnDefinition->getColumnName());37 $this->assertEquals('varchar', $columnTokenizer->getColumnDataType());38 $this->assertEquals('string', $columnDefinition->getMethodName());39 $this->assertCount(0, $columnDefinition->getMethodParameters());40 $this->assertTrue($columnDefinition->isNullable());41 $this->assertEquals('utf8mb4_unicode_ci', $columnDefinition->getCollation());42 $this->assertEquals('orange', $columnDefinition->getDefaultValue());43 $this->assertEquals('$table->string(\'favorite_color\')->nullable()->default(\'orange\')', $columnDefinition->render());44 }45 public function test_it_tokenizes_a_null_varchar_default_value_null_column()46 {47 $columnTokenizer = ColumnTokenizer::parse('`favorite_color` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL');48 $columnDefinition = $columnTokenizer->definition();49 $this->assertEquals('favorite_color', $columnDefinition->getColumnName());50 $this->assertEquals('varchar', $columnTokenizer->getColumnDataType());51 $this->assertEquals('string', $columnDefinition->getMethodName());52 $this->assertCount(0, $columnDefinition->getMethodParameters());53 $this->assertTrue($columnDefinition->isNullable());54 $this->assertEquals('utf8mb4_unicode_ci', $columnDefinition->getCollation());55 $this->assertNull($columnDefinition->getDefaultValue());56 $this->assertEquals('$table->string(\'favorite_color\')->nullable()', $columnDefinition->render());57 }58 //endregion59 //region TEXT & Variants60 public function test_it_tokenizes_a_not_null_tinytext_column()61 {62 $columnTokenizer = ColumnTokenizer::parse('`notes` tinytext NOT NULL');63 $columnDefinition = $columnTokenizer->definition();64 $this->assertEquals('notes', $columnDefinition->getColumnName());65 $this->assertEquals('tinytext', $columnTokenizer->getColumnDataType());66 $this->assertEquals('string', $columnDefinition->getMethodName());67 $this->assertCount(0, $columnDefinition->getMethodParameters());68 $this->assertFalse($columnDefinition->isNullable());69 $this->assertNull($columnDefinition->getCollation());70 $this->assertEquals('$table->string(\'notes\')', $columnDefinition->render());71 }72 public function test_it_tokenizes_a_null_tinytext_column()73 {74 $columnTokenizer = ColumnTokenizer::parse('`notes` tinytext');75 $columnDefinition = $columnTokenizer->definition();76 $this->assertEquals('notes', $columnDefinition->getColumnName());77 $this->assertEquals('tinytext', $columnTokenizer->getColumnDataType());78 $this->assertEquals('string', $columnDefinition->getMethodName());79 $this->assertCount(0, $columnDefinition->getMethodParameters());80 $this->assertTrue($columnDefinition->isNullable());81 $this->assertNull($columnDefinition->getCollation());82 $this->assertEquals('$table->string(\'notes\')->nullable()', $columnDefinition->render());83 }84 public function test_it_tokenizes_a_not_null_text_column()85 {86 $columnTokenizer = ColumnTokenizer::parse('`notes` text NOT NULL');87 $columnDefinition = $columnTokenizer->definition();88 $this->assertEquals('notes', $columnDefinition->getColumnName());89 $this->assertEquals('text', $columnTokenizer->getColumnDataType());90 $this->assertEquals('text', $columnDefinition->getMethodName());91 $this->assertCount(0, $columnDefinition->getMethodParameters());92 $this->assertFalse($columnDefinition->isNullable());93 $this->assertNull($columnDefinition->getCollation());94 $this->assertEquals('$table->text(\'notes\')', $columnDefinition->render());95 }96 public function test_it_tokenizes_a_null_text_column()97 {98 $columnTokenizer = ColumnTokenizer::parse('`notes` text');99 $columnDefinition = $columnTokenizer->definition();100 $this->assertEquals('notes', $columnDefinition->getColumnName());101 $this->assertEquals('text', $columnTokenizer->getColumnDataType());102 $this->assertEquals('text', $columnDefinition->getMethodName());103 $this->assertCount(0, $columnDefinition->getMethodParameters());104 $this->assertTrue($columnDefinition->isNullable());105 $this->assertNull($columnDefinition->getCollation());106 $this->assertEquals('$table->text(\'notes\')->nullable()', $columnDefinition->render());107 }108 public function test_it_tokenizes_a_not_null_mediumtext_column()109 {110 $columnTokenizer = ColumnTokenizer::parse('`notes` mediumtext NOT NULL');111 $columnDefinition = $columnTokenizer->definition();112 $this->assertEquals('notes', $columnDefinition->getColumnName());113 $this->assertEquals('mediumtext', $columnTokenizer->getColumnDataType());114 $this->assertEquals('mediumText', $columnDefinition->getMethodName());115 $this->assertCount(0, $columnDefinition->getMethodParameters());116 $this->assertFalse($columnDefinition->isNullable());117 $this->assertNull($columnDefinition->getCollation());118 $this->assertEquals('$table->mediumText(\'notes\')', $columnDefinition->render());119 }120 public function test_it_tokenizes_a_null_mediumtext_column()121 {122 $columnTokenizer = ColumnTokenizer::parse('`notes` mediumtext');123 $columnDefinition = $columnTokenizer->definition();124 $this->assertEquals('notes', $columnDefinition->getColumnName());125 $this->assertEquals('mediumtext', $columnTokenizer->getColumnDataType());126 $this->assertEquals('mediumText', $columnDefinition->getMethodName());127 $this->assertCount(0, $columnDefinition->getMethodParameters());128 $this->assertTrue($columnDefinition->isNullable());129 $this->assertNull($columnDefinition->getCollation());130 $this->assertEquals('$table->mediumText(\'notes\')->nullable()', $columnDefinition->render());131 }132 public function test_it_tokenizes_a_not_null_longtext_column()133 {134 $columnTokenizer = ColumnTokenizer::parse('`notes` longtext NOT NULL');135 $columnDefinition = $columnTokenizer->definition();136 $this->assertEquals('notes', $columnDefinition->getColumnName());137 $this->assertEquals('longtext', $columnTokenizer->getColumnDataType());138 $this->assertEquals('longText', $columnDefinition->getMethodName());139 $this->assertCount(0, $columnDefinition->getMethodParameters());140 $this->assertFalse($columnDefinition->isNullable());141 $this->assertNull($columnDefinition->getCollation());142 $this->assertEquals('$table->longText(\'notes\')', $columnDefinition->render());143 }144 public function test_it_tokenizes_a_null_longtext_column()145 {146 $columnTokenizer = ColumnTokenizer::parse('`notes` longtext');147 $columnDefinition = $columnTokenizer->definition();148 $this->assertEquals('notes', $columnDefinition->getColumnName());149 $this->assertEquals('longtext', $columnTokenizer->getColumnDataType());150 $this->assertEquals('longText', $columnDefinition->getMethodName());151 $this->assertCount(0, $columnDefinition->getMethodParameters());152 $this->assertTrue($columnDefinition->isNullable());153 $this->assertNull($columnDefinition->getCollation());154 $this->assertEquals('$table->longText(\'notes\')->nullable()', $columnDefinition->render());155 }156 //endregion157 //region INT & Variants158 public function test_it_tokenizes_a_not_null_smallint_without_param_column()159 {160 $columnTokenizer = ColumnTokenizer::parse('`cats` smallint NOT NULL');161 $columnDefinition = $columnTokenizer->definition();162 $this->assertEquals('cats', $columnDefinition->getColumnName());163 $this->assertEquals('smallint', $columnTokenizer->getColumnDataType());164 $this->assertEquals('smallInteger', $columnDefinition->getMethodName());165 $this->assertCount(0, $columnDefinition->getMethodParameters());166 $this->assertFalse($columnDefinition->isNullable());167 $this->assertNull($columnDefinition->getCollation());168 $this->assertEquals('$table->smallInteger(\'cats\')', $columnDefinition->render());169 }170 public function test_it_tokenizes_a_not_null_smallint_with_param_column()171 {172 $columnTokenizer = ColumnTokenizer::parse('`cats` smallint(6) NOT NULL');173 $columnDefinition = $columnTokenizer->definition();174 $this->assertEquals('cats', $columnDefinition->getColumnName());175 $this->assertEquals('smallint', $columnTokenizer->getColumnDataType());176 $this->assertEquals('smallInteger', $columnDefinition->getMethodName());177 $this->assertCount(0, $columnDefinition->getMethodParameters());178 $this->assertFalse($columnDefinition->isNullable());179 $this->assertNull($columnDefinition->getCollation());180 $this->assertEquals('$table->smallInteger(\'cats\')', $columnDefinition->render());181 }182 public function test_it_tokenizes_a_not_null_unsigned_smallint_column()183 {184 $columnTokenizer = ColumnTokenizer::parse('`cats` smallint(6) unsigned NOT NULL');185 $columnDefinition = $columnTokenizer->definition();186 $this->assertEquals('cats', $columnDefinition->getColumnName());187 $this->assertEquals('smallint', $columnTokenizer->getColumnDataType());188 $this->assertEquals('smallInteger', $columnDefinition->getMethodName());189 $this->assertCount(0, $columnDefinition->getMethodParameters());190 $this->assertFalse($columnDefinition->isNullable());191 $this->assertTrue($columnDefinition->isUnsigned());192 $this->assertNull($columnDefinition->getCollation());193 $this->assertEquals('$table->unsignedSmallInteger(\'cats\')', $columnDefinition->render());194 }195 public function test_it_tokenizes_a_nullable_big_int_column()196 {197 $columnTokenizer = ColumnTokenizer::parse('`template_id` bigint(20) unsigned DEFAULT NULL');198 $columnDefinition = $columnTokenizer->definition();199 $this->assertEquals('template_id', $columnDefinition->getColumnName());200 $this->assertEquals('bigint', $columnTokenizer->getColumnDataType());201 $this->assertEquals('bigInteger', $columnDefinition->getMethodName());202 $this->assertCount(0, $columnDefinition->getMethodParameters());203 $this->assertTrue($columnDefinition->isNullable());204 $this->assertTrue($columnDefinition->isUnsigned());205 $this->assertNull($columnDefinition->getCollation());206 $this->assertNull($columnDefinition->getDefaultValue());207 $this->assertEquals('$table->unsignedBigInteger(\'template_id\')->nullable()', $columnDefinition->render());208 }209 public function test_it_tokenizes_a_primary_auto_inc_int_column()210 {211 $columnTokenizer = ColumnTokenizer::parse('`id` int(9) unsigned NOT NULL AUTO_INCREMENT');212 $columnDefinition = $columnTokenizer->definition();213 $this->assertEquals('id', $columnDefinition->getColumnName());214 $this->assertEquals('int', $columnTokenizer->getColumnDataType());215 $this->assertEquals('integer', $columnDefinition->getMethodName());216 $this->assertCount(0, $columnDefinition->getMethodParameters());217 $this->assertFalse($columnDefinition->isPrimary());218 $this->assertFalse($columnDefinition->isNullable());219 $this->assertTrue($columnDefinition->isUnsigned());220 $this->assertNull($columnDefinition->getCollation());221 $this->assertEquals('$table->unsignedInteger(\'id\')', $columnDefinition->render());222 }223 public function test_definition_config()224 {225 config()->set('laravel-migration-generator.definitions.prefer_unsigned_prefix', false);226 $columnTokenizer = ColumnTokenizer::parse('`column` int(9) unsigned NOT NULL');227 $columnDefinition = $columnTokenizer->definition();228 $this->assertEquals('$table->integer(\'column\')->unsigned()', $columnDefinition->render());229 config()->set('laravel-migration-generator.definitions.prefer_unsigned_prefix', true);230 }231 //endregion232 //region FLOAT233 public function test_it_tokenizes_float_without_params_column()234 {235 $columnTokenizer = ColumnTokenizer::parse('`parameter` float NOT NULL');236 $columnDefinition = $columnTokenizer->definition();237 $this->assertEquals('parameter', $columnDefinition->getColumnName());238 $this->assertEquals('float', $columnTokenizer->getColumnDataType());239 $this->assertEquals('float', $columnDefinition->getMethodName());240 $this->assertCount(0, $columnDefinition->getMethodParameters());241 $this->assertFalse($columnDefinition->isNullable());242 $this->assertNull($columnDefinition->getCollation());243 $this->assertEquals('$table->float(\'parameter\')', $columnDefinition->render());244 }245 public function test_it_tokenizes_float_with_params_column()246 {247 $columnTokenizer = ColumnTokenizer::parse('`parameter` float(4,2) NOT NULL');248 $columnDefinition = $columnTokenizer->definition();249 $this->assertEquals('parameter', $columnDefinition->getColumnName());250 $this->assertEquals('float', $columnTokenizer->getColumnDataType());251 $this->assertEquals('float', $columnDefinition->getMethodName());252 $this->assertCount(2, $columnDefinition->getMethodParameters());253 $this->assertEquals(4, $columnDefinition->getMethodParameters()[0]);254 $this->assertEquals(2, $columnDefinition->getMethodParameters()[1]);255 $this->assertFalse($columnDefinition->isNullable());256 $this->assertNull($columnDefinition->getCollation());257 $this->assertEquals('$table->float(\'parameter\', 4, 2)', $columnDefinition->render());258 }259 public function test_it_tokenizes_float_null_without_params_column()260 {261 $columnTokenizer = ColumnTokenizer::parse('`parameter` float');262 $columnDefinition = $columnTokenizer->definition();263 $this->assertEquals('parameter', $columnDefinition->getColumnName());264 $this->assertEquals('float', $columnTokenizer->getColumnDataType());265 $this->assertEquals('float', $columnDefinition->getMethodName());266 $this->assertCount(0, $columnDefinition->getMethodParameters());267 $this->assertTrue($columnDefinition->isNullable());268 $this->assertNull($columnDefinition->getCollation());269 $this->assertEquals('$table->float(\'parameter\')->nullable()', $columnDefinition->render());270 }271 public function test_it_tokenizes_float_null_with_params_column()272 {273 $columnTokenizer = ColumnTokenizer::parse('`parameter` float(4,2)');274 $columnDefinition = $columnTokenizer->definition();275 $this->assertEquals('parameter', $columnDefinition->getColumnName());276 $this->assertEquals('float', $columnTokenizer->getColumnDataType());277 $this->assertEquals('float', $columnDefinition->getMethodName());278 $this->assertCount(2, $columnDefinition->getMethodParameters());279 $this->assertEquals(4, $columnDefinition->getMethodParameters()[0]);280 $this->assertEquals(2, $columnDefinition->getMethodParameters()[1]);281 $this->assertTrue($columnDefinition->isNullable());282 $this->assertNull($columnDefinition->getCollation());283 $this->assertEquals('$table->float(\'parameter\', 4, 2)->nullable()', $columnDefinition->render());284 }285 public function test_it_tokenizes_float_without_params_default_value_column()286 {287 $columnTokenizer = ColumnTokenizer::parse('`parameter` float NOT NULL DEFAULT 1.00');288 $columnDefinition = $columnTokenizer->definition();289 $this->assertEquals('parameter', $columnDefinition->getColumnName());290 $this->assertEquals('float', $columnTokenizer->getColumnDataType());291 $this->assertEquals('float', $columnDefinition->getMethodName());292 $this->assertCount(0, $columnDefinition->getMethodParameters());293 $this->assertEquals(1.0, $columnDefinition->getDefaultValue());294 $this->assertFalse($columnDefinition->isNullable());295 $this->assertNull($columnDefinition->getCollation());296 $this->assertEquals('$table->float(\'parameter\')->default(1.00)', $columnDefinition->render());297 }298 public function test_it_tokenizes_float_with_params_default_value_column()299 {300 $columnTokenizer = ColumnTokenizer::parse('`parameter` float(4,2) NOT NULL DEFAULT 1.00');301 $columnDefinition = $columnTokenizer->definition();302 $this->assertEquals('parameter', $columnDefinition->getColumnName());303 $this->assertEquals('float', $columnTokenizer->getColumnDataType());304 $this->assertEquals('float', $columnDefinition->getMethodName());305 $this->assertCount(2, $columnDefinition->getMethodParameters());306 $this->assertEquals(4, $columnDefinition->getMethodParameters()[0]);307 $this->assertEquals(2, $columnDefinition->getMethodParameters()[1]);308 $this->assertEquals(1.00, $columnDefinition->getDefaultValue());309 $this->assertFalse($columnDefinition->isNullable());310 $this->assertNull($columnDefinition->getCollation());311 $this->assertEquals('$table->float(\'parameter\', 4, 2)->default(1.00)', $columnDefinition->render());312 }313 public function test_it_tokenizes_float_null_without_params_default_value_column()314 {315 $columnTokenizer = ColumnTokenizer::parse('`parameter` float DEFAULT 1.0');316 $columnDefinition = $columnTokenizer->definition();317 $this->assertEquals('parameter', $columnDefinition->getColumnName());318 $this->assertEquals('float', $columnTokenizer->getColumnDataType());319 $this->assertEquals('float', $columnDefinition->getMethodName());320 $this->assertCount(0, $columnDefinition->getMethodParameters());321 $this->assertEquals(1.0, $columnDefinition->getDefaultValue());322 $this->assertTrue($columnDefinition->isNullable());323 $this->assertNull($columnDefinition->getCollation());324 $this->assertEquals('$table->float(\'parameter\')->nullable()->default(1.0)', $columnDefinition->render());325 }326 public function test_it_tokenizes_float_null_with_params_default_value_column()327 {328 $columnTokenizer = ColumnTokenizer::parse('`parameter` float(4,2) DEFAULT 1.00');329 $columnDefinition = $columnTokenizer->definition();330 $this->assertEquals('parameter', $columnDefinition->getColumnName());331 $this->assertEquals('float', $columnTokenizer->getColumnDataType());332 $this->assertEquals('float', $columnDefinition->getMethodName());333 $this->assertCount(2, $columnDefinition->getMethodParameters());334 $this->assertEquals(4, $columnDefinition->getMethodParameters()[0]);335 $this->assertEquals(2, $columnDefinition->getMethodParameters()[1]);336 $this->assertEquals(1.00, $columnDefinition->getDefaultValue());337 $this->assertTrue($columnDefinition->isNullable());338 $this->assertNull($columnDefinition->getCollation());339 $this->assertEquals('$table->float(\'parameter\', 4, 2)->nullable()->default(1.00)', $columnDefinition->render());340 }341 //endregion342 //region DECIMAL343 public function test_it_tokenizes_a_not_null_decimal_column()344 {345 $columnTokenizer = ColumnTokenizer::parse('`amount` decimal(9,2) NOT NULL');346 $columnDefinition = $columnTokenizer->definition();347 $this->assertEquals('amount', $columnDefinition->getColumnName());348 $this->assertEquals('decimal', $columnTokenizer->getColumnDataType());349 $this->assertEquals('decimal', $columnDefinition->getMethodName());350 $this->assertCount(2, $columnDefinition->getMethodParameters());351 $this->assertEquals(9, $columnDefinition->getMethodParameters()[0]);352 $this->assertEquals(2, $columnDefinition->getMethodParameters()[1]);353 $this->assertFalse($columnDefinition->isNullable());354 $this->assertNull($columnDefinition->getCollation());355 $this->assertEquals('$table->decimal(\'amount\', 9, 2)', $columnDefinition->render());356 }357 public function test_it_tokenizes_a_not_null_unsigned_decimal_column()358 {359 $columnTokenizer = ColumnTokenizer::parse('`amount` decimal(9,2) unsigned NOT NULL');360 $columnDefinition = $columnTokenizer->definition();361 $this->assertEquals('amount', $columnDefinition->getColumnName());362 $this->assertEquals('decimal', $columnTokenizer->getColumnDataType());363 $this->assertEquals('decimal', $columnDefinition->getMethodName());364 $this->assertCount(2, $columnDefinition->getMethodParameters());365 $this->assertEquals(9, $columnDefinition->getMethodParameters()[0]);366 $this->assertEquals(2, $columnDefinition->getMethodParameters()[1]);367 $this->assertFalse($columnDefinition->isNullable());368 $this->assertTrue($columnDefinition->isUnsigned());369 $this->assertNull($columnDefinition->getCollation());370 $this->assertEquals('$table->unsignedDecimal(\'amount\', 9, 2)', $columnDefinition->render());371 }372 public function test_it_tokenizes_a_not_null_decimal_with_default_value_column()373 {374 $columnTokenizer = ColumnTokenizer::parse('`amount` decimal(9,2) NOT NULL DEFAULT 1.00');375 $columnDefinition = $columnTokenizer->definition();376 $this->assertEquals('amount', $columnDefinition->getColumnName());377 $this->assertEquals('decimal', $columnTokenizer->getColumnDataType());378 $this->assertEquals('decimal', $columnDefinition->getMethodName());379 $this->assertCount(2, $columnDefinition->getMethodParameters());380 $this->assertEquals(9, $columnDefinition->getMethodParameters()[0]);381 $this->assertEquals(2, $columnDefinition->getMethodParameters()[1]);382 $this->assertFalse($columnDefinition->isNullable());383 $this->assertNull($columnDefinition->getCollation());384 $this->assertEquals(1.0, $columnDefinition->getDefaultValue());385 $this->assertEquals('$table->decimal(\'amount\', 9, 2)->default(1.00)', $columnDefinition->render());386 }387 public function test_it_tokenizes_a_not_null_unsigned_decimal_with_default_value_column()388 {389 $columnTokenizer = ColumnTokenizer::parse('`amount` decimal(9,2) unsigned NOT NULL DEFAULT 1.00');390 $columnDefinition = $columnTokenizer->definition();391 $this->assertEquals('amount', $columnDefinition->getColumnName());392 $this->assertEquals('decimal', $columnTokenizer->getColumnDataType());393 $this->assertEquals('decimal', $columnDefinition->getMethodName());394 $this->assertCount(2, $columnDefinition->getMethodParameters());395 $this->assertEquals(9, $columnDefinition->getMethodParameters()[0]);396 $this->assertEquals(2, $columnDefinition->getMethodParameters()[1]);397 $this->assertEquals(1.0, $columnDefinition->getDefaultValue());398 $this->assertFalse($columnDefinition->isNullable());399 $this->assertTrue($columnDefinition->isUnsigned());400 $this->assertNull($columnDefinition->getCollation());401 $this->assertEquals('$table->unsignedDecimal(\'amount\', 9, 2)->default(1.00)', $columnDefinition->render());402 }403 //endregion404 //region DOUBLE405 public function test_it_tokenizes_a_not_null_double_column()406 {407 $columnTokenizer = ColumnTokenizer::parse('`amount` double(9,2) NOT NULL');408 $columnDefinition = $columnTokenizer->definition();409 $this->assertEquals('amount', $columnDefinition->getColumnName());410 $this->assertEquals('double', $columnTokenizer->getColumnDataType());411 $this->assertEquals('double', $columnDefinition->getMethodName());412 $this->assertCount(2, $columnDefinition->getMethodParameters());413 $this->assertEquals(9, $columnDefinition->getMethodParameters()[0]);414 $this->assertEquals(2, $columnDefinition->getMethodParameters()[1]);415 $this->assertFalse($columnDefinition->isNullable());416 $this->assertNull($columnDefinition->getCollation());417 $this->assertEquals('$table->double(\'amount\', 9, 2)', $columnDefinition->render());418 }419 public function test_it_tokenizes_a_not_null_unsigned_double_column()420 {421 $columnTokenizer = ColumnTokenizer::parse('`amount` double(9,2) unsigned NOT NULL');422 $columnDefinition = $columnTokenizer->definition();423 $this->assertEquals('amount', $columnDefinition->getColumnName());424 $this->assertEquals('double', $columnTokenizer->getColumnDataType());425 $this->assertEquals('double', $columnDefinition->getMethodName());426 $this->assertCount(2, $columnDefinition->getMethodParameters());427 $this->assertEquals(9, $columnDefinition->getMethodParameters()[0]);428 $this->assertEquals(2, $columnDefinition->getMethodParameters()[1]);429 $this->assertFalse($columnDefinition->isNullable());430 $this->assertTrue($columnDefinition->isUnsigned());431 $this->assertNull($columnDefinition->getCollation());432 $this->assertEquals('$table->double(\'amount\', 9, 2)->unsigned()', $columnDefinition->render());433 }434 public function test_it_tokenizes_a_not_null_double_with_default_value_column()435 {436 $columnTokenizer = ColumnTokenizer::parse('`amount` double(9,2) NOT NULL DEFAULT 1.00');437 $columnDefinition = $columnTokenizer->definition();438 $this->assertEquals('amount', $columnDefinition->getColumnName());439 $this->assertEquals('double', $columnTokenizer->getColumnDataType());440 $this->assertEquals('double', $columnDefinition->getMethodName());441 $this->assertCount(2, $columnDefinition->getMethodParameters());442 $this->assertEquals(9, $columnDefinition->getMethodParameters()[0]);443 $this->assertEquals(2, $columnDefinition->getMethodParameters()[1]);444 $this->assertFalse($columnDefinition->isNullable());445 $this->assertNull($columnDefinition->getCollation());446 $this->assertEquals(1.00, $columnDefinition->getDefaultValue());447 $this->assertEquals('$table->double(\'amount\', 9, 2)->default(1.00)', $columnDefinition->render());448 }449 public function test_it_tokenizes_a_not_null_unsigned_double_with_default_value_column()450 {451 $columnTokenizer = ColumnTokenizer::parse('`amount` double(9,2) unsigned NOT NULL DEFAULT 1.00');452 $columnDefinition = $columnTokenizer->definition();453 $this->assertEquals('amount', $columnDefinition->getColumnName());454 $this->assertEquals('double', $columnTokenizer->getColumnDataType());455 $this->assertEquals('double', $columnDefinition->getMethodName());456 $this->assertCount(2, $columnDefinition->getMethodParameters());457 $this->assertEquals(9, $columnDefinition->getMethodParameters()[0]);458 $this->assertEquals(2, $columnDefinition->getMethodParameters()[1]);459 $this->assertEquals(1.00, $columnDefinition->getDefaultValue());460 $this->assertFalse($columnDefinition->isNullable());461 $this->assertTrue($columnDefinition->isUnsigned());462 $this->assertNull($columnDefinition->getCollation());463 $this->assertEquals('$table->double(\'amount\', 9, 2)->unsigned()->default(1.00)', $columnDefinition->render());464 }465 //endregion466 //region DATETIME467 public function test_it_tokenizes_a_not_null_datetime_column()468 {469 $columnTokenizer = ColumnTokenizer::parse('`sent_at` datetime NOT NULL');470 $columnDefinition = $columnTokenizer->definition();471 $this->assertEquals('sent_at', $columnDefinition->getColumnName());472 $this->assertEquals('datetime', $columnTokenizer->getColumnDataType());473 $this->assertEquals('dateTime', $columnDefinition->getMethodName());474 $this->assertCount(0, $columnDefinition->getMethodParameters());475 $this->assertNull($columnDefinition->getDefaultValue());476 $this->assertFalse($columnDefinition->isNullable());477 $this->assertFalse($columnDefinition->isUnsigned());478 $this->assertNull($columnDefinition->getCollation());479 $this->assertEquals('$table->dateTime(\'sent_at\')', $columnDefinition->render());480 }481 public function test_it_tokenizes_a_not_null_datetime_default_now_column()482 {483 $columnTokenizer = ColumnTokenizer::parse('`sent_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP');484 $columnDefinition = $columnTokenizer->definition();485 $this->assertEquals('sent_at', $columnDefinition->getColumnName());486 $this->assertEquals('datetime', $columnTokenizer->getColumnDataType());487 $this->assertEquals('dateTime', $columnDefinition->getMethodName());488 $this->assertCount(0, $columnDefinition->getMethodParameters());489 $this->assertNull($columnDefinition->getDefaultValue());490 $this->assertFalse($columnDefinition->isNullable());491 $this->assertFalse($columnDefinition->isUnsigned());492 $this->assertNull($columnDefinition->getCollation());493 $this->assertEquals('$table->dateTime(\'sent_at\')->useCurrent()', $columnDefinition->render());494 }495 public function test_it_tokenizes_a_null_datetime_column()496 {497 $columnTokenizer = ColumnTokenizer::parse('`sent_at` datetime');498 $columnDefinition = $columnTokenizer->definition();499 $this->assertEquals('sent_at', $columnDefinition->getColumnName());500 $this->assertEquals('datetime', $columnTokenizer->getColumnDataType());501 $this->assertEquals('dateTime', $columnDefinition->getMethodName());502 $this->assertCount(0, $columnDefinition->getMethodParameters());503 $this->assertNull($columnDefinition->getDefaultValue());504 $this->assertTrue($columnDefinition->isNullable());505 $this->assertFalse($columnDefinition->isUnsigned());506 $this->assertNull($columnDefinition->getCollation());507 $this->assertEquals('$table->dateTime(\'sent_at\')->nullable()', $columnDefinition->render());508 }509 public function test_it_tokenizes_a_null_default_value_datetime_column()510 {511 $columnTokenizer = ColumnTokenizer::parse('`sent_at` datetime DEFAULT NULL');512 $columnDefinition = $columnTokenizer->definition();513 $this->assertEquals('sent_at', $columnDefinition->getColumnName());514 $this->assertEquals('datetime', $columnTokenizer->getColumnDataType());515 $this->assertEquals('dateTime', $columnDefinition->getMethodName());516 $this->assertCount(0, $columnDefinition->getMethodParameters());517 $this->assertNull($columnDefinition->getDefaultValue());518 $this->assertTrue($columnDefinition->isNullable());519 $this->assertFalse($columnDefinition->isUnsigned());520 $this->assertNull($columnDefinition->getCollation());521 $this->assertEquals('$table->dateTime(\'sent_at\')->nullable()', $columnDefinition->render());522 }523 public function test_it_tokenizes_a_null_default_value_now_datetime_column()524 {525 $columnTokenizer = ColumnTokenizer::parse('`sent_at` datetime DEFAULT CURRENT_TIMESTAMP');526 $columnDefinition = $columnTokenizer->definition();527 $this->assertEquals('sent_at', $columnDefinition->getColumnName());528 $this->assertEquals('datetime', $columnTokenizer->getColumnDataType());529 $this->assertEquals('dateTime', $columnDefinition->getMethodName());530 $this->assertCount(0, $columnDefinition->getMethodParameters());531 $this->assertNull($columnDefinition->getDefaultValue());532 $this->assertTrue($columnDefinition->isNullable());533 $this->assertFalse($columnDefinition->isUnsigned());534 $this->assertNull($columnDefinition->getCollation());535 $this->assertEquals('$table->dateTime(\'sent_at\')->nullable()->useCurrent()', $columnDefinition->render());536 }537 public function test_it_tokenizes_a_null_default_value_now_and_on_update_datetime_column()538 {539 $columnTokenizer = ColumnTokenizer::parse('`sent_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP');540 $columnDefinition = $columnTokenizer->definition();541 $this->assertEquals('sent_at', $columnDefinition->getColumnName());542 $this->assertEquals('datetime', $columnTokenizer->getColumnDataType());543 $this->assertEquals('dateTime', $columnDefinition->getMethodName());544 $this->assertCount(0, $columnDefinition->getMethodParameters());545 $this->assertNull($columnDefinition->getDefaultValue());546 $this->assertTrue($columnDefinition->isNullable());547 $this->assertFalse($columnDefinition->isUnsigned());548 $this->assertNull($columnDefinition->getCollation());549 $this->assertEquals('$table->dateTime(\'sent_at\')->nullable()->useCurrent()->useCurrentOnUpdate()', $columnDefinition->render());550 }551 //endregion552 //region TIMESTAMP553 public function test_it_tokenizes_a_not_null_timestamp_column()554 {555 $columnTokenizer = ColumnTokenizer::parse('`sent_at` timestamp NOT NULL');556 $columnDefinition = $columnTokenizer->definition();557 $this->assertEquals('sent_at', $columnDefinition->getColumnName());558 $this->assertEquals('timestamp', $columnTokenizer->getColumnDataType());559 $this->assertEquals('timestamp', $columnDefinition->getMethodName());560 $this->assertCount(0, $columnDefinition->getMethodParameters());561 $this->assertNull($columnDefinition->getDefaultValue());562 $this->assertFalse($columnDefinition->isNullable());563 $this->assertFalse($columnDefinition->isUnsigned());564 $this->assertNull($columnDefinition->getCollation());565 $this->assertEquals('$table->timestamp(\'sent_at\')', $columnDefinition->render());566 }567 public function test_it_tokenizes_a_null_timestamp_column()568 {569 $columnTokenizer = ColumnTokenizer::parse('`sent_at` timestamp');570 $columnDefinition = $columnTokenizer->definition();571 $this->assertEquals('sent_at', $columnDefinition->getColumnName());572 $this->assertEquals('timestamp', $columnTokenizer->getColumnDataType());573 $this->assertEquals('timestamp', $columnDefinition->getMethodName());574 $this->assertCount(0, $columnDefinition->getMethodParameters());575 $this->assertNull($columnDefinition->getDefaultValue());576 $this->assertTrue($columnDefinition->isNullable());577 $this->assertFalse($columnDefinition->isUnsigned());578 $this->assertNull($columnDefinition->getCollation());579 $this->assertEquals('$table->timestamp(\'sent_at\')->nullable()', $columnDefinition->render());580 }581 public function test_it_tokenizes_a_not_null_use_current_timestamp_timestamp_column()582 {583 $columnTokenizer = ColumnTokenizer::parse('`sent_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP');584 $columnDefinition = $columnTokenizer->definition();585 $this->assertEquals('sent_at', $columnDefinition->getColumnName());586 $this->assertEquals('timestamp', $columnTokenizer->getColumnDataType());587 $this->assertEquals('timestamp', $columnDefinition->getMethodName());588 $this->assertCount(0, $columnDefinition->getMethodParameters());589 $this->assertNull($columnDefinition->getDefaultValue());590 $this->assertFalse($columnDefinition->isNullable());591 $this->assertFalse($columnDefinition->isUnsigned());592 $this->assertNull($columnDefinition->getCollation());593 $this->assertEquals('$table->timestamp(\'sent_at\')->useCurrent()', $columnDefinition->render());594 }595 public function test_it_tokenizes_a_not_null_default_value_timestamp_column()596 {597 $columnTokenizer = ColumnTokenizer::parse('`sent_at` timestamp NOT NULL DEFAULT \'2000-01-01 00:00:01\'');598 $columnDefinition = $columnTokenizer->definition();599 $this->assertEquals('sent_at', $columnDefinition->getColumnName());600 $this->assertEquals('timestamp', $columnTokenizer->getColumnDataType());601 $this->assertEquals('timestamp', $columnDefinition->getMethodName());602 $this->assertCount(0, $columnDefinition->getMethodParameters());603 $this->assertEquals('2000-01-01 00:00:01', $columnDefinition->getDefaultValue());604 $this->assertFalse($columnDefinition->isNullable());605 $this->assertFalse($columnDefinition->isUnsigned());606 $this->assertNull($columnDefinition->getCollation());607 $this->assertEquals('$table->timestamp(\'sent_at\')->default(\'2000-01-01 00:00:01\')', $columnDefinition->render());608 }609 public function test_it_tokenizes_a_null_default_value_timestamp_column()610 {611 $columnTokenizer = ColumnTokenizer::parse('`sent_at` timestamp NULL DEFAULT \'2000-01-01 00:00:01\'');612 $columnDefinition = $columnTokenizer->definition();613 $this->assertEquals('sent_at', $columnDefinition->getColumnName());614 $this->assertEquals('timestamp', $columnTokenizer->getColumnDataType());615 $this->assertEquals('timestamp', $columnDefinition->getMethodName());616 $this->assertCount(0, $columnDefinition->getMethodParameters());617 $this->assertEquals('2000-01-01 00:00:01', $columnDefinition->getDefaultValue());618 $this->assertTrue($columnDefinition->isNullable());619 $this->assertFalse($columnDefinition->isUnsigned());620 $this->assertNull($columnDefinition->getCollation());621 $this->assertEquals('$table->timestamp(\'sent_at\')->nullable()->default(\'2000-01-01 00:00:01\')', $columnDefinition->render());622 }623 //endregion624 //region ENUM625 public function test_it_tokenizes_enum_column()626 {627 $columnTokenizer = ColumnTokenizer::parse('`status_flag` enum(\'1\',\'2\',\'3\',\'4\')');628 $columnDefinition = $columnTokenizer->definition();629 $this->assertEquals('status_flag', $columnDefinition->getColumnName());630 $this->assertEquals('enum', $columnTokenizer->getColumnDataType());631 $this->assertEquals('enum', $columnDefinition->getMethodName());632 $this->assertCount(4, $columnDefinition->getMethodParameters()[0]);633 $this->assertEqualsCanonicalizing([1, 2, 3, 4], $columnDefinition->getMethodParameters()[0]);634 $this->assertTrue($columnDefinition->isNullable());635 $this->assertNull($columnDefinition->getCollation());636 $this->assertEquals('$table->enum(\'status_flag\', [\'1\', \'2\', \'3\', \'4\'])->nullable()', $columnDefinition->render());637 }638 public function test_it_tokenizes_not_null_enum_column()639 {640 $columnTokenizer = ColumnTokenizer::parse('`status_flag` enum(\'1\',\'2\',\'3\',\'4\') NOT NULL');641 $columnDefinition = $columnTokenizer->definition();642 $this->assertEquals('status_flag', $columnDefinition->getColumnName());643 $this->assertEquals('enum', $columnTokenizer->getColumnDataType());644 $this->assertEquals('enum', $columnDefinition->getMethodName());645 $this->assertCount(4, $columnDefinition->getMethodParameters()[0]);646 $this->assertEqualsCanonicalizing([1, 2, 3, 4], $columnDefinition->getMethodParameters()[0]);647 $this->assertFalse($columnDefinition->isNullable());648 $this->assertNull($columnDefinition->getCollation());649 $this->assertEquals('$table->enum(\'status_flag\', [\'1\', \'2\', \'3\', \'4\'])', $columnDefinition->render());650 }651 public function test_it_tokenizes_enum_with_default_value_column()652 {653 $columnTokenizer = ColumnTokenizer::parse('`status_flag` enum(\'1\',\'2\',\'3\',\'4\') DEFAULT NULL');654 $columnDefinition = $columnTokenizer->definition();655 $this->assertEquals('status_flag', $columnDefinition->getColumnName());656 $this->assertEquals('enum', $columnTokenizer->getColumnDataType());657 $this->assertEquals('enum', $columnDefinition->getMethodName());658 $this->assertCount(4, $columnDefinition->getMethodParameters()[0]);659 $this->assertEqualsCanonicalizing([1, 2, 3, 4], $columnDefinition->getMethodParameters()[0]);660 $this->assertNull($columnDefinition->getDefaultValue());661 $this->assertTrue($columnDefinition->isNullable());662 $this->assertNull($columnDefinition->getCollation());663 $this->assertEquals('$table->enum(\'status_flag\', [\'1\', \'2\', \'3\', \'4\'])->nullable()', $columnDefinition->render());664 }665 public function test_it_tokenizes_not_null_enum_with_default_value_column()666 {667 $columnTokenizer = ColumnTokenizer::parse('`status_flag` enum(\'1\',\'2\',\'3\',\'4\') NOT NULL DEFAULT \'1\'');668 $columnDefinition = $columnTokenizer->definition();669 $this->assertEquals('status_flag', $columnDefinition->getColumnName());670 $this->assertEquals('enum', $columnTokenizer->getColumnDataType());671 $this->assertEquals('enum', $columnDefinition->getMethodName());672 $this->assertCount(4, $columnDefinition->getMethodParameters()[0]);673 $this->assertEqualsCanonicalizing([1, 2, 3, 4], $columnDefinition->getMethodParameters()[0]);674 $this->assertEquals('1', $columnDefinition->getDefaultValue());675 $this->assertFalse($columnDefinition->isNullable());676 $this->assertNull($columnDefinition->getCollation());677 $this->assertEquals('$table->enum(\'status_flag\', [\'1\', \'2\', \'3\', \'4\'])->default(\'1\')', $columnDefinition->render());678 }679 public function test_it_tokenizes_enum_with_spaces()680 {681 $columnTokenizer = ColumnTokenizer::parse('`calculate` enum(\'one\',\'and\',\'highest or\',\'lowest or\',\'sum\',\'highest position or\',\'lowest position or\') COLLATE utf8mb4_general_ci NOT NULL COMMENT \'set the way we calculate a feature value. with high or low or the sort is by position\'');682 $definition = $columnTokenizer->definition();683 $this->assertEquals('$table->enum(\'calculate\', [\'one\', \'and\', \'highest or\', \'lowest or\', \'sum\', \'highest position or\', \'lowest position or\'])', $definition->render());684 }685 public function test_it_tokenizes_enum_with_special_characters()686 {687 $columnTokenizer = ColumnTokenizer::parse('`calculate` enum(\'one\',\'and\',\'highest-or\',\'lowest^or\',\'sum%\',\'highest $ position or\',\'lowest+_<>?/ position or\',\'"quoted"\') COLLATE utf8mb4_general_ci NOT NULL COMMENT \'set the way we calculate a feature value. with high or low or the sort is by position\'');688 $definition = $columnTokenizer->definition();689 $this->assertEquals('$table->enum(\'calculate\', [\'one\', \'and\', \'highest-or\', \'lowest^or\', \'sum%\', \'highest $ position or\', \'lowest+_<>?/ position or\', \'"quoted"\'])', $definition->render());690 }691 //endregion692 //region POINT, MULTIPOINT693 public function test_it_tokenizes_point_column()694 {695 $columnTokenizer = ColumnTokenizer::parse('`point` point NOT NULL');696 $columnDefinition = $columnTokenizer->definition();697 $this->assertEquals('point', $columnTokenizer->getColumnDataType());698 $this->assertEquals('point', $columnDefinition->getMethodName());699 $this->assertCount(0, $columnDefinition->getMethodParameters());700 $this->assertEquals('$table->point(\'point\')', $columnDefinition->render());701 }702 public function test_it_tokenizes_multipoint_column()703 {704 $columnTokenizer = ColumnTokenizer::parse('`point` multipoint NOT NULL');705 $columnDefinition = $columnTokenizer->definition();706 $this->assertEquals('multipoint', $columnTokenizer->getColumnDataType());707 $this->assertEquals('multiPoint', $columnDefinition->getMethodName());708 $this->assertCount(0, $columnDefinition->getMethodParameters());709 $this->assertEquals('$table->multiPoint(\'point\')', $columnDefinition->render());710 }711 //endregion712 //region POLYGON, MULTIPOLYGON713 public function test_it_tokenizes_polygon_column()714 {715 $columnTokenizer = ColumnTokenizer::parse('`polygon` polygon NOT NULL');716 $columnDefinition = $columnTokenizer->definition();717 $this->assertEquals('polygon', $columnTokenizer->getColumnDataType());718 $this->assertEquals('polygon', $columnDefinition->getMethodName());719 $this->assertCount(0, $columnDefinition->getMethodParameters());720 $this->assertEquals('$table->polygon(\'polygon\')', $columnDefinition->render());721 }722 public function test_it_tokenizes_multipolygon_column()723 {724 $columnTokenizer = ColumnTokenizer::parse('`polygon` multipolygon NOT NULL');725 $columnDefinition = $columnTokenizer->definition();726 $this->assertEquals('multipolygon', $columnTokenizer->getColumnDataType());727 $this->assertEquals('multiPolygon', $columnDefinition->getMethodName());728 $this->assertCount(0, $columnDefinition->getMethodParameters());729 $this->assertEquals('$table->multiPolygon(\'polygon\')', $columnDefinition->render());730 }731 //endregion,732 //region GEOMETRY733 public function test_it_tokenizes_geometry_column()734 {735 $columnTokenizer = ColumnTokenizer::parse('`geometry` geometry NOT NULL');736 $columnDefinition = $columnTokenizer->definition();737 $this->assertEquals('geometry', $columnTokenizer->getColumnDataType());738 $this->assertEquals('geometry', $columnDefinition->getMethodName());739 $this->assertCount(0, $columnDefinition->getMethodParameters());740 }741 public function test_it_tokenizes_geometry_collection_column()742 {743 $columnTokenizer = ColumnTokenizer::parse('`geometry_collection` geometrycollection NOT NULL');744 $columnDefinition = $columnTokenizer->definition();745 $this->assertEquals('geometrycollection', $columnTokenizer->getColumnDataType());746 $this->assertEquals('geometryCollection', $columnDefinition->getMethodName());747 $this->assertCount(0, $columnDefinition->getMethodParameters());748 }749 //endregion750 //region SET751 public function test_it_tokenizes_set_column()752 {753 $columnTokenizer = ColumnTokenizer::parse('`set_field` set(\'1\',\'2\',\'3\') COLLATE utf8mb4_unicode_ci DEFAULT NULL');754 $columnDefinition = $columnTokenizer->definition();755 $this->assertEquals('set', $columnTokenizer->getColumnDataType());756 $this->assertEquals('set', $columnDefinition->getMethodName());757 $this->assertCount(1, $columnDefinition->getMethodParameters());758 $this->assertNotNull($columnDefinition->getCollation());759 $this->assertTrue($columnDefinition->isNullable());760 $this->assertEquals('$table->set(\'set_field\', [\'1\', \'2\', \'3\'])->nullable()', $columnDefinition->render());761 }762 //endregion763 //region UUID764 public function test_it_tokenizes_uuid_column()765 {766 $columnTokenizer = ColumnTokenizer::parse('`uuid_col` char(36) COLLATE utf8mb4_unicode_ci NOT NULL');767 $columnDefinition = $columnTokenizer->definition();768 $this->assertEquals('char', $columnTokenizer->getColumnDataType());769 $this->assertEquals('char', $columnDefinition->getMethodName());770 $this->assertCount(0, $columnDefinition->getMethodParameters());771 $this->assertNotNull($columnDefinition->getCollation());772 $this->assertFalse($columnDefinition->isNullable());773 $this->assertEquals('$table->uuid(\'uuid_col\')', $columnDefinition->render());774 }775 //endregion776 //region DATE, YEAR, TIME777 public function test_it_tokenizes_date_column()778 {779 $columnTokenizer = ColumnTokenizer::parse('`birth_date` date NOT NULL');780 $columnDefinition = $columnTokenizer->definition();781 $this->assertEquals('date', $columnTokenizer->getColumnDataType());782 $this->assertEquals('date', $columnDefinition->getMethodName());783 $this->assertCount(0, $columnDefinition->getMethodParameters());784 $this->assertNull($columnDefinition->getCollation());785 $this->assertFalse($columnDefinition->isNullable());786 $this->assertEquals('$table->date(\'birth_date\')', $columnDefinition->render());787 }788 public function test_it_tokenizes_year_column()789 {790 $columnTokenizer = ColumnTokenizer::parse('`birth_year` year NOT NULL');791 $columnDefinition = $columnTokenizer->definition();792 $this->assertEquals('year', $columnTokenizer->getColumnDataType());793 $this->assertEquals('year', $columnDefinition->getMethodName());794 $this->assertCount(0, $columnDefinition->getMethodParameters());795 $this->assertNull($columnDefinition->getCollation());796 $this->assertFalse($columnDefinition->isNullable());797 $this->assertEquals('$table->year(\'birth_year\')', $columnDefinition->render());798 }799 public function test_it_tokenizes_time_column()800 {801 $columnTokenizer = ColumnTokenizer::parse('`birth_time` time NOT NULL');802 $columnDefinition = $columnTokenizer->definition();803 $this->assertEquals('time', $columnTokenizer->getColumnDataType());804 $this->assertEquals('time', $columnDefinition->getMethodName());805 $this->assertCount(0, $columnDefinition->getMethodParameters());806 $this->assertNull($columnDefinition->getCollation());807 $this->assertFalse($columnDefinition->isNullable());808 $this->assertEquals('$table->time(\'birth_time\')', $columnDefinition->render());809 }810 //endregion811 //region LINESTRING, MULTILINESTRING812 public function test_it_tokenizes_linestring_column()813 {814 $columnTokenizer = ColumnTokenizer::parse('`str` linestring NOT NULL');815 $columnDefinition = $columnTokenizer->definition();816 $this->assertEquals('linestring', $columnTokenizer->getColumnDataType());817 $this->assertEquals('lineString', $columnDefinition->getMethodName());818 $this->assertCount(0, $columnDefinition->getMethodParameters());819 $this->assertNull($columnDefinition->getCollation());820 $this->assertFalse($columnDefinition->isNullable());821 $this->assertEquals('$table->lineString(\'str\')', $columnDefinition->render());822 }823 public function test_it_tokenizes_multilinestring_column()824 {825 $columnTokenizer = ColumnTokenizer::parse('`str` multilinestring NOT NULL');826 $columnDefinition = $columnTokenizer->definition();827 $this->assertEquals('multilinestring', $columnTokenizer->getColumnDataType());828 $this->assertEquals('multiLineString', $columnDefinition->getMethodName());829 $this->assertCount(0, $columnDefinition->getMethodParameters());830 $this->assertNull($columnDefinition->getCollation());831 $this->assertFalse($columnDefinition->isNullable());832 $this->assertEquals('$table->multiLineString(\'str\')', $columnDefinition->render());833 }834 //endregion835 public function test_it_tokenizes_generated_as_column()836 {837 $columnTokenizer = ColumnTokenizer::parse('`total` decimal(24,6) GENERATED ALWAYS AS ((`quantity` * `unit_price`)) STORED');838 $columnDefinition = $columnTokenizer->definition();839 $this->assertEquals('decimal', $columnTokenizer->getColumnDataType());840 $this->assertEquals('decimal', $columnDefinition->getMethodName());841 $this->assertFalse($columnDefinition->isNullable());842 $this->assertEquals('(`quantity` * `unit_price`)', $columnDefinition->getStoredAs());843 $this->assertEquals('$table->decimal(\'total\', 24, 6)->storedAs("(`quantity` * `unit_price`)")', $columnDefinition->render());844 }845 public function test_it_tokenizes_generated_as_column_example(){846 $columnTokenizer = ColumnTokenizer::parse('`full_name` varchar(150) COLLATE utf8mb4_unicode_ci GENERATED ALWAYS AS (concat(`first_name`,\' \',`last_name`)) STORED');847 $columnDefinition = $columnTokenizer->definition();848 $this->assertEquals('varchar', $columnTokenizer->getColumnDataType());849 $this->assertEquals('string', $columnDefinition->getMethodName());850 $this->assertFalse($columnDefinition->isNullable());851 $this->assertEquals('(concat(`first_name`,\' \',`last_name`))', $columnDefinition->getStoredAs());852 $this->assertEquals('$table->string(\'full_name\', 150)->storedAs("(concat(`first_name`,\' \',`last_name`))")', $columnDefinition->render());853 }854 public function test_it_tokenizes_virtual_as_column()855 {856 $columnTokenizer = ColumnTokenizer::parse('`total` decimal(24,6) AS ((`quantity` * `unit_price`))');857 $columnDefinition = $columnTokenizer->definition();858 $this->assertEquals('decimal', $columnTokenizer->getColumnDataType());859 $this->assertEquals('decimal', $columnDefinition->getMethodName());860 $this->assertFalse($columnDefinition->isNullable());861 $this->assertEquals('(`quantity` * `unit_price`)', $columnDefinition->getVirtualAs());862 $this->assertEquals('$table->decimal(\'total\', 24, 6)->virtualAs("(`quantity` * `unit_price`)")', $columnDefinition->render());863 }864}...
getMethodName
Using AI Code Generation
1echo or::getMethodName(1);2echo or::getMethodName(2);3echo or::getMethodName(3);4echo or::getMethodName(4);5echo or::getMethodName(5);6echo or::getMethodName(6);7echo or::getMethodName(7);8echo or::getMethodName(8);9echo or::getMethodName(9);10echo or::getMethodName(10);11echo or::getMethodName(11);12echo or::getMethodName(12);13echo or::getMethodName(13);14echo or::getMethodName(14);15echo or::getMethodName(15);16echo or::getMethodName(16);17echo or::getMethodName(17);18echo or::getMethodName(18);19echo or::getMethodName(19);
getMethodName
Using AI Code Generation
1require_once 'or.php';2$or = new or();3echo $or->getMethodName();4require_once 'or.php';5$or = new or();6echo $or->getMethodName();7require_once 'or.php';8$or = new or();9echo $or->getMethodName();10require_once 'or.php';11$or = new or();12echo $or->getMethodName();13require_once 'or.php';14$or = new or();15echo $or->getMethodName();16require_once 'or.php';17$or = new or();18echo $or->getMethodName();19require_once 'or.php';20$or = new or();21echo $or->getMethodName();22require_once 'or.php';23$or = new or();24echo $or->getMethodName();25require_once 'or.php';26$or = new or();27echo $or->getMethodName();28require_once 'or.php';29$or = new or();30echo $or->getMethodName();31require_once 'or.php';32$or = new or();33echo $or->getMethodName();34require_once 'or.php';35$or = new or();36echo $or->getMethodName();37require_once 'or.php';38$or = new or();39echo $or->getMethodName();40require_once 'or.php';41$or = new or();
getMethodName
Using AI Code Generation
1require_once '1.php';2$or = new or();3echo $or->getMethodName();4require_once '1.php';5$or = new or();6echo $or->getMethodName();7require_once '1.php';8$or = new or();9echo $or->getMethodName();10require_once '1.php';11$or = new or();12echo $or->getMethodName();13require_once '1.php';14$or = new or();15echo $or->getMethodName();16require_once '1.php';17$or = new or();18echo $or->getMethodName();19require_once '1.php';20$or = new or();21echo $or->getMethodName();22require_once '1.php';23$or = new or();24echo $or->getMethodName();25require_once '1.php';26$or = new or();27echo $or->getMethodName();28require_once '1.php';29$or = new or();30echo $or->getMethodName();31require_once '1.php';32$or = new or();33echo $or->getMethodName();34require_once '1.php';35$or = new or();36echo $or->getMethodName();37require_once '1.php';38$or = new or();39echo $or->getMethodName();40require_once '1.php';41$or = new or();
getMethodName
Using AI Code Generation
1$or = new or;2$or->getMethodName();3$and = new and;4$and->getMethodName();5$or = new or;6$or->getMethodName();7$and = new and;8$and->getMethodName();9$or = new or;10$or->getMethodName();11$and = new and;12$and->getMethodName();13$or = new or;14$or->getMethodName();15$and = new and;16$and->getMethodName();17$or = new or;18$or->getMethodName();19$and = new and;20$and->getMethodName();21$or = new or;22$or->getMethodName();23$and = new and;24$and->getMethodName();25$or = new or;26$or->getMethodName();27$and = new and;28$and->getMethodName();29$or = new or;30$or->getMethodName();31$and = new and;32$and->getMethodName();33$or = new or;34$or->getMethodName();
getMethodName
Using AI Code Generation
1require_once('or.php');2$or = new or();3$or->getMethodName();4require_once('or.php');5require_once('myclass.php');6$myclass = new myclass();7$myclass->getMethodName();8require_once('or.php');9$or = new or();10$or->getMethodName();
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Execute automation tests with getMethodName on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.
Test now for FreeGet 100 minutes of automation test minutes FREE!!