From 63ab12b61c3c08554e730b6307f9b40d6c9c31b9 Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 25 Jan 2024 08:47:22 +0900 Subject: [PATCH] test: update testInsertBatch() to use various data types --- tests/system/Database/Live/InsertTest.php | 34 +++++++++++++++++------ 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/tests/system/Database/Live/InsertTest.php b/tests/system/Database/Live/InsertTest.php index cd40a179dd4d..72afb83c8d58 100644 --- a/tests/system/Database/Live/InsertTest.php +++ b/tests/system/Database/Live/InsertTest.php @@ -49,21 +49,39 @@ public function testInsert(): void public function testInsertBatch(): void { - $jobData = [ + $table = 'type_test'; + + $builder = $this->db->table($table); + $builder->truncate(); + + $data = [ [ - 'name' => 'Comedian', - 'description' => 'Theres something in your teeth', + 'type_varchar' => 'test1', + 'type_char' => 'char', + 'type_smallint' => 32767, + 'type_integer' => 2_147_483_647, + 'type_bigint' => 9_223_372_036_854_775_807, + 'type_numeric' => 123.23, + 'type_date' => '2023-12-01', + 'type_datetime' => '2023-12-21 12:00:00', ], [ - 'name' => 'Cab Driver', - 'description' => 'Iam yellow', + 'type_varchar' => 'test2', + 'type_char' => 'char', + 'type_smallint' => 32767, + 'type_integer' => 2_147_483_647, + 'type_bigint' => 9_223_372_036_854_775_807, + 'type_numeric' => 123.23, + 'type_date' => '2023-12-02', + 'type_datetime' => '2023-12-21 12:00:00', ], ]; - $this->db->table('job')->insertBatch($jobData); + $this->db->table($table)->insertBatch($data); - $this->seeInDatabase('job', ['name' => 'Comedian']); - $this->seeInDatabase('job', ['name' => 'Cab Driver']); + $expected = $data; + $this->seeInDatabase($table, $expected[0]); + $this->seeInDatabase($table, $expected[1]); } public function testReplaceWithNoMatchingData(): void