Skip to content

Commit e9d6dd8

Browse files
stefanak-michaltransistive
authored andcommitted
reset, or not to reset
1 parent cf090d3 commit e9d6dd8

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

src/Bolt/BoltUnmanagedTransaction.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ public function runStatement(Statement $statement)
109109
$this->config->getAccessMode()
110110
);
111111
} catch (Throwable $e) {
112+
$this->connection->reset();
112113
$this->isRolledBack = true;
113114
throw $e;
114115
}

tests/Integration/ClientIntegrationTest.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,8 @@ public function testValidRun(): void
8787

8888
public function testInvalidRun(): void
8989
{
90-
$exception = false;
91-
try {
92-
$this->getSession()->transaction(static fn (TransactionInterface $tsx) => $tsx->run('MERGE (x:Tes0342hdm21.())', ['test' => 'a', 'otherTest' => 'b']));
93-
} catch (Neo4jException) {
94-
$exception = true;
95-
}
96-
self::assertTrue($exception);
90+
$this->expectException(Neo4jException::class);
91+
$this->getSession()->transaction(static fn (TransactionInterface $tsx) => $tsx->run('MERGE (x:Tes0342hdm21.())', ['test' => 'a', 'otherTest' => 'b']));
9792
}
9893

9994
public function testInvalidRunRetry(): void
@@ -106,7 +101,8 @@ public function testInvalidRunRetry(): void
106101
}
107102
self::assertTrue($exception);
108103

109-
$this->getSession()->run('RETURN 1 AS one');
104+
$response = $this->getSession()->run('RETURN 1 AS one');
105+
$this->assertEquals(1, $response->first()->get('one'));
110106
}
111107

112108
public function testValidStatement(): void
@@ -142,7 +138,7 @@ public function testStatements(): void
142138
$response = $this->getSession()->runStatements([
143139
Statement::create('MERGE (x:TestNode {test: $test})', $params),
144140
Statement::create('MERGE (x:OtherTestNode {test: $otherTest})', $params),
145-
Statement::create('RETURN 1 AS x', []),
141+
Statement::create('RETURN 1 AS x'),
146142
]);
147143

148144
self::assertEquals(3, $response->count());

0 commit comments

Comments
 (0)