Skip to content

Commit afcd624

Browse files
authored
Merge pull request #6570 from greg0ire/4.2.x
Merge 3.9.x up into 4.2.x
2 parents 7fc3811 + ab44df6 commit afcd624

File tree

2 files changed

+34
-3
lines changed

2 files changed

+34
-3
lines changed

.github/workflows/continuous-integration.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ jobs:
372372
mysql-version:
373373
- "5.7"
374374
- "8.0"
375-
- "9.0"
375+
- "9.1"
376376
extension:
377377
- "mysqli"
378378
- "pdo_mysql"
@@ -401,10 +401,10 @@ jobs:
401401
custom-entrypoint: >-
402402
--entrypoint sh mysql:8.4 -c "exec docker-entrypoint.sh mysqld --mysql-native-password=ON"
403403
- php-version: "8.4"
404-
mysql-version: "9.0"
404+
mysql-version: "9.1"
405405
extension: "mysqli"
406406
- php-version: "8.4"
407-
mysql-version: "9.0"
407+
mysql-version: "9.1"
408408
extension: "pdo_mysql"
409409

410410
services:

tests/ConnectionTest.php

+31
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
use PHPUnit\Framework\TestCase;
2626
use Psr\Cache\CacheItemInterface;
2727
use Psr\Cache\CacheItemPoolInterface;
28+
use RuntimeException;
2829

2930
/** @psalm-import-type Params from DriverManager */
3031
#[RequiresPhpExtension('pdo_mysql')]
@@ -172,6 +173,36 @@ public function testCommitStartsTransactionInNoAutoCommitMode(): void
172173
self::assertTrue($conn->isTransactionActive());
173174
}
174175

176+
public function testBeginTransactionFailureAfterCommitInNoAutoCommitMode(): void
177+
{
178+
$driverConnectionMock = $this->createMock(DriverConnection::class);
179+
$driverConnectionMock->expects(self::exactly(2))
180+
->method('beginTransaction')
181+
->willReturnOnConsecutiveCalls(
182+
true,
183+
self::throwException(new RuntimeException()),
184+
);
185+
186+
$driver = self::createStub(Driver::class);
187+
$driver
188+
->method('connect')
189+
->willReturn(
190+
$driverConnectionMock,
191+
);
192+
$conn = new Connection([], $driver);
193+
194+
$conn->setAutoCommit(false);
195+
196+
/** Invoke protected {@see Connection::connect()} */
197+
$conn->getServerVersion();
198+
try {
199+
$conn->commit();
200+
} catch (RuntimeException) {
201+
}
202+
203+
self::assertTrue($conn->isTransactionActive());
204+
}
205+
175206
/** @return bool[][] */
176207
public static function resultProvider(): array
177208
{

0 commit comments

Comments
 (0)