From ad6daecdfe4341510ba52db46ed83797fdda8cd1 Mon Sep 17 00:00:00 2001 From: Valerii Gorbachev Date: Mon, 8 Feb 2021 22:31:41 +0300 Subject: [PATCH] Add test for issue #14663 --- tests/framework/db/mysql/QueryBuilderTest.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/framework/db/mysql/QueryBuilderTest.php b/tests/framework/db/mysql/QueryBuilderTest.php index ebb89d7..2865dc3 100644 --- a/tests/framework/db/mysql/QueryBuilderTest.php +++ b/tests/framework/db/mysql/QueryBuilderTest.php @@ -367,4 +367,30 @@ MySqlStatement; $this->assertNotFalse($commentPos); $this->assertLessThan($checkPos, $commentPos); } + + /** + * Test for issue https://github.com/yiisoft/yii2/issues/14663 + */ + public function testInsertInteger() + { + $db = $this->getConnection(); + + $command = $db->createCommand(); + + $sql = $command->insert( + '{{customer}}', + [ + 'profile_id' => 22, + ] + )->getRawSql(); + $this->assertEquals('INSERT INTO `customer` (`profile_id`) VALUES (22)', $sql); + + $sql = $command->insert( + '{{customer}}', + [ + 'profile_id' => '1000000000000', + ] + )->getRawSql(); + $this->assertEquals('INSERT INTO `customer` (`profile_id`) VALUES (1000000000000)', $sql); + } }