function TransactionTest::testTransactionName
Tests for transaction names.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Database/ TransactionTest.php, line 1008
Class
- TransactionTest
- Tests the transactions, using the explicit ::commitOrRelease method.
Namespace
Drupal\KernelTests\Core\DatabaseCode
public function testTransactionName() : void {
$transaction = $this->createRootTransaction('', FALSE);
$this->assertSame('drupal_transaction', $transaction->name());
$savepoint1 = $this->createFirstSavepointTransaction('', FALSE);
$this->assertSame('savepoint_1', $savepoint1->name());
$this->expectException(TransactionNameNonUniqueException::class);
$this->expectExceptionMessage("savepoint_1 is already in use.");
$this->connection
->startTransaction('savepoint_1');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.