function TransactionManagerTest::testTransactionRollbackToSavepointFailure

Tests failure when rolling back a transaction to a savepoint.

File

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

Class

TransactionManagerTest
Tests transactions.

Namespace

Drupal\Tests\Core\Database

Code

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

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