$this->connection->
insert('test'
) ->
fields([ 'name' => 'David' .
$suffix,
'age' => '24',
]) ->
execute();
$this->
assertTrue($this->connection->
inTransaction(), 'In transaction before calling nested transaction.'
);
// We're already in a transaction, but we call ->transactionInnerLayer
// to nest another transaction inside the current one.
$this->
transactionInnerLayer($suffix,
$rollback,
$ddl_statement);
$this->
assertTrue($this->connection->
inTransaction(), 'In transaction after calling nested transaction.'
);
if ($rollback) { // Roll back the transaction, if requested.
// This rollback should propagate to the last savepoint.
$txn->
rollBack();
$this->
assertSame($depth,
$this->connection->
transactionDepth(), 'Transaction has rolled back to the last savepoint after calling rollBack().'
);
} }