function DriverSpecificTransactionTestBase::testTransactionName

Same name in other branches
  1. 11.x core/tests/Drupal/KernelTests/Core/Database/DriverSpecificTransactionTestBase.php \Drupal\KernelTests\Core\Database\DriverSpecificTransactionTestBase::testTransactionName()

Tests for transaction names.

File

core/tests/Drupal/KernelTests/Core/Database/DriverSpecificTransactionTestBase.php, line 743

Class

DriverSpecificTransactionTestBase
Tests the transaction abstraction system.

Namespace

Drupal\KernelTests\Core\Database

Code

public function testTransactionName() : void {
    $transaction = $this->createRootTransaction('', FALSE);
    $this->assertSame('drupal_transaction', $transaction->name());
    $savepoint1 = $this->createFirstSavepointTransaction('', FALSE);
    $this->assertSame('savepoint_1', $savepoint1->name());
    $this->expectException(TransactionNameNonUniqueException::class);
    $this->expectExceptionMessage("savepoint_1 is already in use.");
    $savepointFailure = $this->connection
        ->startTransaction('savepoint_1');
}

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