function TransactionManagerTest::testStartTransactionFailure

Tests failing to start a transaction.

File

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

Class

TransactionManagerTest
Tests transactions.

Namespace

Drupal\Tests\Core\Database

Code

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

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