Skip to content

Commit

Permalink
Merge commit '2161a70e7' into 4.2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
greg0ire committed Nov 4, 2024
2 parents 604277e + 2161a70 commit f57a8ff
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,5 @@ test_script:
after_test:
- appveyor DownloadFile https://codecov.io/bash -FileName codecov.sh
- bash codecov.sh -f clover.xml
- SET upload_name=appveyor-%db%-%db_version%-%driver%-php-%php%
- bash codecov.sh -f clover.xml -n %upload_name%
1 change: 1 addition & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -654,5 +654,6 @@ jobs:
with:
directory: reports
fail_ci_if_error: true
name: github-action
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
40 changes: 40 additions & 0 deletions tests/ConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,46 @@ public function testConnectStartsTransactionInNoAutoCommitMode(): void
self::assertTrue($conn->isTransactionActive());
}

public function testTransactionIsNotActiveAfterTransactionalInAutoCommitMode(): void
{
$driverMock = self::createStub(Driver::class);
$driverMock
->method('connect')
->willReturn(
self::createStub(DriverConnection::class),
);

$conn = new Connection([], $driverMock);

$conn->setAutoCommit(true);

self::assertFalse($conn->isTransactionActive());

$conn->transactional(static function (Connection $connection): void {
});

self::assertFalse($conn->isTransactionActive());
}

public function testTransactionIsActiveAfterTransactionalInNoAutoCommitMode(): void
{
$driverMock = $this->createMock(Driver::class);
$driverMock
->method('connect')
->willReturn(
self::createStub(DriverConnection::class),
);

$conn = new Connection([], $driverMock);

$conn->setAutoCommit(false);

$conn->transactional(static function (Connection $connection): void {
});

self::assertTrue($conn->isTransactionActive());
}

public function testCommitStartsTransactionInNoAutoCommitMode(): void
{
$driver = self::createStub(Driver::class);
Expand Down

0 comments on commit f57a8ff

Please sign in to comment.