function TransactionManagerTest::testStateAfterTransactionReleaseSavepointFailure
Checks TransactionManager after release savepoint failure.
File
-
core/
tests/ Drupal/ Tests/ Core/ Database/ TransactionManagerTest.php, line 196
Class
- TransactionManagerTest
- Tests transactions.
Namespace
Drupal\Tests\Core\DatabaseCode
public function testStateAfterTransactionReleaseSavepointFailure() : void {
try {
// phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
$tx = $this->connection
->startTransaction();
$savepoint = $this->connection
->startTransaction('foo');
$this->connection
->transactionManager()->success = FALSE;
$savepoint->commitOrRelease();
} catch (TransactionCommitFailedException) {
// Continue.
}
$this->assertSame(0, $this->connection
->transactionManager()
->stackDepth());
$this->assertFalse($this->connection
->transactionManager()
->has('foo'));
$this->assertFalse($this->connection
->transactionManager()
->has('drupal_transaction'));
$this->assertFalse($this->connection
->inTransaction());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.