function TransactionManagerTest::testTransactionReleaseSavepointFailure

Tests a transaction release savepoint failure.

File

core/tests/Drupal/Tests/Core/Database/TransactionManagerTest.php, line 183

Class

TransactionManagerTest
Tests transactions.

Namespace

Drupal\Tests\Core\Database

Code

public function testTransactionReleaseSavepointFailure() : void {
  // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
  $tx = $this->connection
    ->startTransaction();
  $savepoint = $this->connection
    ->startTransaction('foo');
  $this->connection
    ->transactionManager()->success = FALSE;
  $this->expectException(TransactionCommitFailedException::class);
  $this->expectExceptionMessage('Failed release of savepoint foo');
  $savepoint->commitOrRelease();
}

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