function TransactionTest::testRollbackRootWithActiveSavepoint
Tests root transaction rollback failure when savepoint is open.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Database/ TransactionTest.php, line 219
Class
- TransactionTest
- Tests the transactions, using the explicit ::commitOrRelease method.
Namespace
Drupal\KernelTests\Core\DatabaseCode
public function testRollbackRootWithActiveSavepoint() : void {
$transaction = $this->createRootTransaction();
// phpcs:ignore DrupalPractice.CodeAnalysis.VariableAnalysis
$savepoint = $this->createFirstSavepointTransaction();
// Try to rollback root. Since a savepoint is active, this should fail.
$this->expectException(TransactionOutOfOrderException::class);
$this->expectExceptionMessageMatches("/^Error attempting rollback of .*\\\\drupal_transaction\\. Active stack: .*\\\\drupal_transaction > .*\\\\savepoint_1/");
$transaction->rollBack();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.