function DriverSpecificTransactionTestBase::testRootTransactionEndCallbackAddedWithoutTransaction

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

Tests that adding a post-transaction callback fails with no transaction.

File

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

Class

DriverSpecificTransactionTestBase
Tests the transaction abstraction system.

Namespace

Drupal\KernelTests\Core\Database

Code

public function testRootTransactionEndCallbackAddedWithoutTransaction() : void {
    $this->expectException(\LogicException::class);
    $this->connection
        ->transactionManager()
        ->addPostTransactionCallback([
        $this,
        'rootTransactionCallback',
    ]);
}

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