function TransactionTest::testRollbackRoot

Tests root transaction rollback.

File

core/tests/Drupal/KernelTests/Core/Database/TransactionTest.php, line 182

Class

TransactionTest
Tests the transactions, using the explicit ::commitOrRelease method.

Namespace

Drupal\KernelTests\Core\Database

Code

public function testRollbackRoot() : void {
    $transaction = $this->createRootTransaction();
    // Rollback. Since we are at the root, the transaction is closed.
    // Corresponds to 'ROLLBACK' on the database.
    $transaction->rollBack();
    $this->assertRowAbsent('David');
    $this->assertFalse($this->connection
        ->inTransaction());
    $this->assertSame(0, $this->connection
        ->transactionManager()
        ->stackDepth());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.