Skip to content

Commit

Permalink
fix: backport #166
Browse files Browse the repository at this point in the history
  • Loading branch information
dkkoma committed Nov 19, 2024
1 parent 2d1d098 commit 0792bd9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Concerns/ManagesTransactions.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ protected function performRollBack($toLevel)

if ($this->currentTransaction !== null) {
try {
if ($this->currentTransaction->state() === Transaction::STATE_ACTIVE) {
if ($this->currentTransaction->state() === Transaction::STATE_ACTIVE && $this->currentTransaction->id() !== null) {
$this->currentTransaction->rollBack();
}
} finally {
Expand Down
2 changes: 1 addition & 1 deletion tests/Query/BuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ public function test_whereLike(): void
$caughtException = $ex;
}
if (getenv('SPANNER_EMULATOR_HOST')) {
$this->assertStringContainsString('INTERNAL', $caughtException?->getMessage());
$this->assertStringContainsString('Invalid UTF-8', $caughtException?->getMessage());
} else {
$this->assertStringContainsString('Invalid request proto: an error was encountered during deserialization of the request proto.', $caughtException?->getMessage());
}
Expand Down
4 changes: 2 additions & 2 deletions tests/SessionNotFoundTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,13 @@ public function test_session_not_found_on_cursor(): void
$passes = 0;

$conn->transaction(function () use ($conn, &$passes) {
$cursor = $conn->cursor('SELECT 12345');

if ($passes === 0) {
$this->deleteSession($conn);
$passes++;
}

$cursor = $conn->cursor('SELECT 12345');

$this->assertEquals([12345], $cursor->current());

$passes++;
Expand Down

0 comments on commit 0792bd9

Please sign in to comment.