function DriverSpecificTransactionTestBase::createFirstSavepointTransaction
Same name in other branches
- 11.x core/tests/Drupal/KernelTests/Core/Database/DriverSpecificTransactionTestBase.php \Drupal\KernelTests\Core\Database\DriverSpecificTransactionTestBase::createFirstSavepointTransaction()
Create a Drupal savepoint transaction after root.
10 calls to DriverSpecificTransactionTestBase::createFirstSavepointTransaction()
- DriverSpecificTransactionTestBase::testCommitWithActiveSavepoint in core/
tests/ Drupal/ KernelTests/ Core/ Database/ DriverSpecificTransactionTestBase.php - Tests committing a transaction while savepoints are active.
- DriverSpecificTransactionTestBase::testReleaseIntermediateSavepoint in core/
tests/ Drupal/ KernelTests/ Core/ Database/ DriverSpecificTransactionTestBase.php - Tests releasing a savepoint before last is safe.
- DriverSpecificTransactionTestBase::testRollbackRootAfterSavepointRollback in core/
tests/ Drupal/ KernelTests/ Core/ Database/ DriverSpecificTransactionTestBase.php - Tests root transaction rollback after savepoint rollback.
- DriverSpecificTransactionTestBase::testRollbackRootWithActiveSavepoint in core/
tests/ Drupal/ KernelTests/ Core/ Database/ DriverSpecificTransactionTestBase.php - Tests root transaction rollback failure when savepoint is open.
- DriverSpecificTransactionTestBase::testRollbackSavepoint in core/
tests/ Drupal/ KernelTests/ Core/ Database/ DriverSpecificTransactionTestBase.php - Tests savepoint transaction rollback.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Database/ DriverSpecificTransactionTestBase.php, line 74
Class
- DriverSpecificTransactionTestBase
- Tests the transaction abstraction system.
Namespace
Drupal\KernelTests\Core\DatabaseCode
protected function createFirstSavepointTransaction(string $name = '', bool $insertRow = TRUE) : Transaction {
$this->assertTrue($this->connection
->inTransaction());
$this->assertSame(1, $this->connection
->transactionManager()
->stackDepth());
// Starts a savepoint transaction. Corresponds to 'SAVEPOINT savepoint_1'
// on the database. The name can be changed by the $name argument.
$savepoint = $this->connection
->startTransaction($name);
$this->assertTrue($this->connection
->inTransaction());
$this->assertSame(2, $this->connection
->transactionManager()
->stackDepth());
// Insert a single row into the testing table.
if ($insertRow) {
$this->insertRow('Roger');
$this->assertRowPresent('Roger');
}
return $savepoint;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.