|
14 | 14 | namespace Laudis\Neo4j\Tests\Integration;
|
15 | 15 |
|
16 | 16 | use Laudis\Neo4j\Databags\Statement;
|
| 17 | +use Laudis\Neo4j\Exception\ClientException; |
17 | 18 | use Laudis\Neo4j\Exception\Neo4jException;
|
18 | 19 | use Laudis\Neo4j\Tests\EnvironmentAwareIntegrationTest;
|
19 | 20 | use PHPUnit\Framework\Attributes\DoesNotPerformAssertions;
|
@@ -213,61 +214,60 @@ public function testCommitValidFilledWithInvalidStatement(): void
|
213 | 214 | }
|
214 | 215 |
|
215 | 216 | // TODO commit on READY state cause stuck neo4j connection on older version and disconnect at newer
|
216 |
| -// public function testCommitInvalid(): void |
217 |
| -// { |
218 |
| -// $tsx = $this->getSession()->beginTransaction(); |
219 |
| -// $tsx->commit(); |
220 |
| -// |
221 |
| -// self::assertTrue($tsx->isFinished()); |
222 |
| -// self::assertFalse($tsx->isRolledBack()); |
223 |
| -// self::assertTrue($tsx->isCommitted()); |
224 |
| -// |
225 |
| -// $exception = false; |
226 |
| -// try { |
227 |
| -// $tsx->commit(); |
228 |
| -// } catch (Throwable) { |
229 |
| -// $exception = true; |
230 |
| -// } |
231 |
| -// self::assertTrue($exception); |
232 |
| -// |
233 |
| -// self::assertTrue($tsx->isFinished()); |
234 |
| -// self::assertTrue($tsx->isRolledBack()); |
235 |
| -// self::assertFalse($tsx->isCommitted()); |
236 |
| -// } |
| 217 | + public function testCommitInvalid(): void |
| 218 | + { |
| 219 | + $tsx = $this->getSession()->beginTransaction(); |
| 220 | + $tsx->commit(); |
| 221 | + |
| 222 | + self::assertTrue($tsx->isFinished()); |
| 223 | + self::assertFalse($tsx->isRolledBack()); |
| 224 | + self::assertTrue($tsx->isCommitted()); |
| 225 | + |
| 226 | + $exception = null; |
| 227 | + try { |
| 228 | + $tsx->commit(); |
| 229 | + } catch (ClientException $e) { |
| 230 | + $exception = $e; |
| 231 | + } |
| 232 | + self::assertTrue($exception instanceof ClientException); |
| 233 | + |
| 234 | + self::assertTrue($tsx->isFinished()); |
| 235 | + self::assertFalse($tsx->isRolledBack()); |
| 236 | + self::assertTrue($tsx->isCommitted()); |
| 237 | + } |
237 | 238 |
|
238 | 239 | public function testRollbackValid(): void
|
239 | 240 | {
|
240 |
| - $this->markTestSkipped('Skipped due to ConnectionTimeoutException'); |
241 |
| -// $tsx = $this->getSession()->beginTransaction(); |
242 |
| -// $tsx->rollback(); |
243 |
| -// |
244 |
| -// self::assertTrue($tsx->isFinished()); |
245 |
| -// self::assertTrue($tsx->isRolledBack()); |
246 |
| -// self::assertFalse($tsx->isCommitted()); |
| 241 | + $tsx = $this->getSession()->beginTransaction(); |
| 242 | + $tsx->rollback(); |
| 243 | + |
| 244 | + self::assertTrue($tsx->isFinished()); |
| 245 | + self::assertTrue($tsx->isRolledBack()); |
| 246 | + self::assertFalse($tsx->isCommitted()); |
247 | 247 | }
|
248 | 248 |
|
249 | 249 | // TODO rollback on READY state cause stuck neo4j connection on older version and disconnect at newer
|
250 |
| -// public function testRollbackInvalid(): void |
251 |
| -// { |
252 |
| -// $tsx = $this->getSession()->beginTransaction(); |
253 |
| -// $tsx->rollback(); |
254 |
| -// |
255 |
| -// self::assertTrue($tsx->isFinished()); |
256 |
| -// self::assertTrue($tsx->isRolledBack()); |
257 |
| -// self::assertFalse($tsx->isCommitted()); |
258 |
| -// |
259 |
| -// $exception = false; |
260 |
| -// try { |
261 |
| -// $tsx->rollback(); |
262 |
| -// } catch (Throwable) { |
263 |
| -// $exception = true; |
264 |
| -// } |
265 |
| -// self::assertTrue($exception); |
266 |
| -// |
267 |
| -// self::assertTrue($tsx->isFinished()); |
268 |
| -// self::assertTrue($tsx->isRolledBack()); |
269 |
| -// self::assertFalse($tsx->isCommitted()); |
270 |
| -// } |
| 250 | + public function testRollbackInvalid(): void |
| 251 | + { |
| 252 | + $tsx = $this->getSession()->beginTransaction(); |
| 253 | + $tsx->rollback(); |
| 254 | + |
| 255 | + self::assertTrue($tsx->isFinished()); |
| 256 | + self::assertTrue($tsx->isRolledBack()); |
| 257 | + self::assertFalse($tsx->isCommitted()); |
| 258 | + |
| 259 | + $exception = null; |
| 260 | + try { |
| 261 | + $tsx->rollback(); |
| 262 | + } catch (ClientException $e) { |
| 263 | + $exception = $e; |
| 264 | + } |
| 265 | + self::assertTrue($exception instanceof ClientException); |
| 266 | + |
| 267 | + self::assertTrue($tsx->isFinished()); |
| 268 | + self::assertTrue($tsx->isRolledBack()); |
| 269 | + self::assertFalse($tsx->isCommitted()); |
| 270 | + } |
271 | 271 |
|
272 | 272 | // /**
|
273 | 273 | // * TODO - rework this test
|
|
0 commit comments