function TransactionManagerTest::testTransactionReleaseSavepoint
Tests releasing a savepoint.
File
-
core/
tests/ Drupal/ Tests/ Core/ Database/ TransactionManagerTest.php, line 168
Class
- TransactionManagerTest
- Tests transactions.
Namespace
Drupal\Tests\Core\DatabaseCode
public function testTransactionReleaseSavepoint() : void {
$tx = $this->connection
->startTransaction();
$savepoint = $this->connection
->startTransaction('foo');
$savepoint->commitOrRelease();
$this->assertSame(1, $this->connection
->transactionManager()
->stackDepth());
$this->assertFalse($this->connection
->transactionManager()
->has('foo'));
$this->assertTrue($this->connection
->inTransaction());
$tx->commitOrRelease();
$this->assertSame(0, $this->connection
->transactionManager()
->stackDepth());
$this->assertFalse($this->connection
->inTransaction());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.