Skip to content

Commit

Permalink
Test Command::insertWithReturningPks() with empty values (#791)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tigrov authored Dec 21, 2023
1 parent 447a0f0 commit 064e076
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/Common/CommonCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2015,4 +2015,27 @@ public function testDecimalValue(): void

$this->assertSame($decimalValue, $phpTypecastValue);
}

public function testInsertWithReturningPksEmptyValues()
{
$db = $this->getConnection(true);

$pkValues = $db->createCommand()->insertWithReturningPks('null_values', []);

$expected = match ($db->getDriverName()) {
'pgsql' => ['id' => 1],
default => ['id' => '1'],
};

$this->assertSame($expected, $pkValues);
}

public function testInsertWithReturningPksEmptyValuesAndNoPk()
{
$db = $this->getConnection(true);

$pkValues = $db->createCommand()->insertWithReturningPks('negative_default_values', []);

$this->assertSame([], $pkValues);
}
}

0 comments on commit 064e076

Please sign in to comment.