diff --git a/src/Codeception/Module/Db.php b/src/Codeception/Module/Db.php index db418bd3..2143aaf5 100644 --- a/src/Codeception/Module/Db.php +++ b/src/Codeception/Module/Db.php @@ -808,7 +808,9 @@ private function addInsertedRow(string $table, array $row, $id): void { $primaryKey = $this->_getDriver()->getPrimaryKey($table); $primary = []; - if ($primaryKey !== []) { + if (count($primaryKey) == 1 && is_null($row[$primaryKey[0]])) { + $primary[$primaryKey[0]] = $id; + } elseif ($primaryKey !== []) { $filledKeys = array_intersect($primaryKey, array_keys($row)); $missingPrimaryKeyColumns = array_diff_key($primaryKey, $filledKeys);