From 6bc0d00e335ff296ad697c208904c7287be0e391 Mon Sep 17 00:00:00 2001 From: mondrake Date: Thu, 31 Aug 2023 09:40:31 +0200 Subject: [PATCH] I --- tests/src/Kernel/mysqli/TransactionTest.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/src/Kernel/mysqli/TransactionTest.php b/tests/src/Kernel/mysqli/TransactionTest.php index cf5130f..91365ff 100644 --- a/tests/src/Kernel/mysqli/TransactionTest.php +++ b/tests/src/Kernel/mysqli/TransactionTest.php @@ -113,4 +113,23 @@ public function testConnectionDeprecations(): void { $this->markTestSkipped('Skipping this for mysqli'); } + /** + * Tests starting a transaction when there's one active on the client. + */ + public function testStartTransactionWhenActive(): void { + $this->connection->getClientConnection()->begin_transaction(); + $this->connection->startTransaction(); + } + + /** + * Tests committing a transaction when there's none active on the client. + */ + public function testStartTransactionWhenActive(): void { + $transaction = $this->connection->startTransaction(); + $this->assertTrue($this->connection->inTransaction()); + $this->connection->getClientConnection()->commit(); + $transaction = NULL; + $this->assertFalse($this->connection->inTransaction()); + } + }