Closed JesusTheHun closed 1 year ago
Thank you
@JesusTheHun What about using haveInDatabase
on a table that does not have auto increment on any column?
Currently, it gives this error:
[TypeError] Codeception\Lib\Driver\Db::lastInsertId(): Return value must be of type string, bool returned
yes, it is a bug, please raise pull request to fix it.
@YaakovR can you tell me what db you are using ? I tried with MySQL which (sadly) returns 0
when no id has been generated.
@JesusTheHun SQL Server
Right now
Db::addInsertedRow()
uses thelastInsertId
to remove the row during tear down. In some case the primary key is not auto incremented but another column is.The row being referenced with
['id' => 1]
because$driver->lastInsertId()
returns1
, and the module assumes it's the PK value.This PR fixes this behaviour by checking if the provided values cover the primary key. If so, it uses those value, if not it follows the default behaviour.