Skip to content

Commit

Permalink
Merge pull request #8450 from kenjis/test-postgre-qb-InsertBatch
Browse files Browse the repository at this point in the history
test: update testInsertBatch() to use various data types
  • Loading branch information
kenjis authored Jan 25, 2024
2 parents 5fd5f63 + 63ab12b commit 88547ad
Showing 1 changed file with 26 additions and 8 deletions.
34 changes: 26 additions & 8 deletions tests/system/Database/Live/InsertTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,39 @@ public function testInsert(): void

public function testInsertBatch(): void

Check warning on line 50 in tests/system/Database/Live/InsertTest.php

View workflow job for this annotation

GitHub Actions / DatabaseLive (8.1, OCI8, 8.0) / tests

Took 1.15s from 0.50s limit to run CodeIgniter\\Database\\Live\\InsertTest::testInsertBatch
{
$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
Expand Down

0 comments on commit 88547ad

Please sign in to comment.