Loading core/tests/Drupal/KernelTests/Core/Database/DriverSpecificTransactionTestBase.php +20 −6 Changes for core/tests/Drupal/KernelTests/Core/Database/DriverSpecificTransactionTestBase.php: 20 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -56,6 +56,10 @@ abstract class DriverSpecificTransactionTestBase extends DriverSpecificDatabaseT /** * Create a root Drupal transaction. * * Keep the return value in a variable for as long as you need the * transaction open. It commits or releases itself when destructed, so * dropping the variable ends the transaction early. */ protected function createRootTransaction(string $name = '', bool $insertRow = TRUE): Transaction { $this->assertFalse($this->connection->inTransaction()); Loading @@ -78,6 +82,9 @@ protected function createRootTransaction(string $name = '', bool $insertRow = TR /** * Create a Drupal savepoint transaction after root. * * Same rule as createRootTransaction(): keep the return value in scope * for as long as you need the savepoint open. */ protected function createFirstSavepointTransaction(string $name = '', bool $insertRow = TRUE): Transaction { $this->assertTrue($this->connection->inTransaction()); Loading Loading @@ -248,6 +255,8 @@ public function testRollbackRootAfterSavepointRollback(): void { */ public function testRollbackRootWithActiveSavepoint(): void { $transaction = $this->createRootTransaction(); // $savepoint must be kept alive until the end of the test; see // createFirstSavepointTransaction(). // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis $savepoint = $this->createFirstSavepointTransaction(); Loading Loading @@ -289,6 +298,8 @@ public function testRollbackSavepoint(): void { * Tests savepoint transaction duplicated rollback. */ public function testRollbackTwiceSameSavepoint(): void { // $transaction must be kept alive until the end of the test; see // createRootTransaction(). // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis $transaction = $this->createRootTransaction(); $savepoint = $this->createFirstSavepointTransaction(); Loading Loading @@ -324,12 +335,14 @@ public function testRollbackTwiceSameSavepoint(): void { * Tests savepoint transaction rollback failure when later savepoints exist. */ public function testRollbackSavepointWithLaterSavepoint(): void { // $transaction must be kept alive until the end of the test; see // createRootTransaction(). // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis $transaction = $this->createRootTransaction(); $savepoint1 = $this->createFirstSavepointTransaction(); // Starts another savepoint transaction. Corresponds to 'SAVEPOINT // savepoint_2' on the database. // Starts another savepoint transaction ('SAVEPOINT savepoint_2'). // $savepoint2 must stay in scope or the savepoint ends early. // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis $savepoint2 = $this->connection->startTransaction(); $this->assertTrue($this->connection->inTransaction()); Loading Loading @@ -720,13 +733,12 @@ public function testReleaseIntermediateSavepoint(): void { // on the database. $savepoint2 = $this->connection->startTransaction(); $this->assertSame(3, $this->connection->transactionManager()->stackDepth()); // Starts a savepoint transaction. Corresponds to 'SAVEPOINT savepoint_3' // on the database. // Starts a savepoint transaction ('SAVEPOINT savepoint_3'). // $savepoint3 must stay in scope or the savepoint ends early. // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis $savepoint3 = $this->connection->startTransaction(); $this->assertSame(4, $this->connection->transactionManager()->stackDepth()); // Starts a savepoint transaction. Corresponds to 'SAVEPOINT savepoint_4' // on the database. // Same as above ('SAVEPOINT savepoint_4'). // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis $savepoint4 = $this->connection->startTransaction(); $this->assertSame(5, $this->connection->transactionManager()->stackDepth()); Loading Loading @@ -755,6 +767,8 @@ public function testReleaseIntermediateSavepoint(): void { #[IgnoreDeprecations] public function testCommitWithActiveSavepoint(): void { $transaction = $this->createRootTransaction(); // $savepoint1 must be kept alive until the end of the test; see // createFirstSavepointTransaction(). // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis $savepoint1 = $this->createFirstSavepointTransaction('', FALSE); Loading Loading
core/tests/Drupal/KernelTests/Core/Database/DriverSpecificTransactionTestBase.php +20 −6 Changes for core/tests/Drupal/KernelTests/Core/Database/DriverSpecificTransactionTestBase.php: 20 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -56,6 +56,10 @@ abstract class DriverSpecificTransactionTestBase extends DriverSpecificDatabaseT /** * Create a root Drupal transaction. * * Keep the return value in a variable for as long as you need the * transaction open. It commits or releases itself when destructed, so * dropping the variable ends the transaction early. */ protected function createRootTransaction(string $name = '', bool $insertRow = TRUE): Transaction { $this->assertFalse($this->connection->inTransaction()); Loading @@ -78,6 +82,9 @@ protected function createRootTransaction(string $name = '', bool $insertRow = TR /** * Create a Drupal savepoint transaction after root. * * Same rule as createRootTransaction(): keep the return value in scope * for as long as you need the savepoint open. */ protected function createFirstSavepointTransaction(string $name = '', bool $insertRow = TRUE): Transaction { $this->assertTrue($this->connection->inTransaction()); Loading Loading @@ -248,6 +255,8 @@ public function testRollbackRootAfterSavepointRollback(): void { */ public function testRollbackRootWithActiveSavepoint(): void { $transaction = $this->createRootTransaction(); // $savepoint must be kept alive until the end of the test; see // createFirstSavepointTransaction(). // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis $savepoint = $this->createFirstSavepointTransaction(); Loading Loading @@ -289,6 +298,8 @@ public function testRollbackSavepoint(): void { * Tests savepoint transaction duplicated rollback. */ public function testRollbackTwiceSameSavepoint(): void { // $transaction must be kept alive until the end of the test; see // createRootTransaction(). // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis $transaction = $this->createRootTransaction(); $savepoint = $this->createFirstSavepointTransaction(); Loading Loading @@ -324,12 +335,14 @@ public function testRollbackTwiceSameSavepoint(): void { * Tests savepoint transaction rollback failure when later savepoints exist. */ public function testRollbackSavepointWithLaterSavepoint(): void { // $transaction must be kept alive until the end of the test; see // createRootTransaction(). // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis $transaction = $this->createRootTransaction(); $savepoint1 = $this->createFirstSavepointTransaction(); // Starts another savepoint transaction. Corresponds to 'SAVEPOINT // savepoint_2' on the database. // Starts another savepoint transaction ('SAVEPOINT savepoint_2'). // $savepoint2 must stay in scope or the savepoint ends early. // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis $savepoint2 = $this->connection->startTransaction(); $this->assertTrue($this->connection->inTransaction()); Loading Loading @@ -720,13 +733,12 @@ public function testReleaseIntermediateSavepoint(): void { // on the database. $savepoint2 = $this->connection->startTransaction(); $this->assertSame(3, $this->connection->transactionManager()->stackDepth()); // Starts a savepoint transaction. Corresponds to 'SAVEPOINT savepoint_3' // on the database. // Starts a savepoint transaction ('SAVEPOINT savepoint_3'). // $savepoint3 must stay in scope or the savepoint ends early. // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis $savepoint3 = $this->connection->startTransaction(); $this->assertSame(4, $this->connection->transactionManager()->stackDepth()); // Starts a savepoint transaction. Corresponds to 'SAVEPOINT savepoint_4' // on the database. // Same as above ('SAVEPOINT savepoint_4'). // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis $savepoint4 = $this->connection->startTransaction(); $this->assertSame(5, $this->connection->transactionManager()->stackDepth()); Loading Loading @@ -755,6 +767,8 @@ public function testReleaseIntermediateSavepoint(): void { #[IgnoreDeprecations] public function testCommitWithActiveSavepoint(): void { $transaction = $this->createRootTransaction(); // $savepoint1 must be kept alive until the end of the test; see // createFirstSavepointTransaction(). // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis $savepoint1 = $this->createFirstSavepointTransaction('', FALSE); Loading