function TransactionTest::testStartTransactionWhenActive

Tests starting a transaction when there's one active on the client.

MySQLi does not fail if multiple commits are made on the client, so this test is failing. Let's change this if/when MySQLi will provide a way to check if a client transaction is active.

This is mitigated by the fact that transaction should not be initiated from code outside the TransactionManager, that keeps track of the stack of transaction-related operations in its stack.

File

core/modules/mysqli/tests/src/Kernel/mysqli/TransactionTest.php, line 27

Class

TransactionTest
Tests transaction for the MySQLi driver.

Namespace

Drupal\Tests\mysqli\Kernel\mysqli

Code

public function testStartTransactionWhenActive() : void {
  $this->markTestSkipped('Skipping this while MySQLi cannot detect if a client transaction is active.');
  $this->connection
    ->getClientConnection()
    ->begin_transaction();
  $this->connection
    ->startTransaction();
  $this->assertFalse($this->connection
    ->inTransaction());
}

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