function TransactionTest::testDeprecationOfImplicitCommit

Same name and namespace in other branches
  1. main core/tests/Drupal/KernelTests/Core/Database/TransactionTest.php \Drupal\KernelTests\Core\Database\TransactionTest::testDeprecationOfImplicitCommit()

Tests deprecation of implicit commit.

Attributes

#[IgnoreDeprecations]

File

core/tests/Drupal/KernelTests/Core/Database/TransactionTest.php, line 1333

Class

TransactionTest
Tests the transactions, using the explicit ::commitOrRelease method.

Namespace

Drupal\KernelTests\Core\Database

Code

public function testDeprecationOfImplicitCommit() : void {
  $this->expectUserDeprecationMessage('Database commit by letting a Transaction object go out of scope is deprecated in drupal:11.5.0 and is removed from drupal:13.0.0. Commit explicitly via Transaction::commitOrRelease() instead. See https://www.drupal.org/node/3524461');
  $transaction = $this->createRootTransaction();
  unset($transaction);
  $this->assertRowPresent('David');
}

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