|
13 | 13 |
|
14 | 14 | namespace Laudis\Neo4j\Tests\Integration;
|
15 | 15 |
|
| 16 | +use Bolt\error\ConnectException; |
16 | 17 | use Generator;
|
17 | 18 | use function getenv;
|
18 | 19 | use InvalidArgumentException;
|
@@ -270,11 +271,50 @@ public function testPeriodicCommitFail(string $alias): void
|
270 | 271 | /**
|
271 | 272 | * @dataProvider connectionAliases
|
272 | 273 | */
|
273 |
| - public function testLongQuery(string $alias): void |
| 274 | + public function testLongQueryFunction(string $alias): void |
274 | 275 | {
|
275 | 276 | $this->client->writeTransaction(static function (TransactionInterface $tsx) {
|
276 | 277 | $tsx->run('UNWIND range(1, 10000) AS x MERGE (:Number {value: x})');
|
277 | 278 | }, $alias, TransactionConfiguration::default()->withTimeout(100000));
|
278 | 279 | self::assertTrue(true);
|
279 | 280 | }
|
| 281 | + |
| 282 | + /** |
| 283 | + * @dataProvider connectionAliases |
| 284 | + */ |
| 285 | + public function testLongQueryFunctionNegative(string $alias): void |
| 286 | + { |
| 287 | + if (str_starts_with($alias, 'http')) { |
| 288 | + self::markTestSkipped('HTTP does not support tsx timeout at the moment.'); |
| 289 | + } |
| 290 | + |
| 291 | + $this->expectException(ConnectException::class); |
| 292 | + $this->client->writeTransaction(static function (TransactionInterface $tsx) { |
| 293 | + $tsx->run('UNWIND range(1, 10000) AS x MERGE (:Number {value: x})'); |
| 294 | + }, $alias, TransactionConfiguration::default()->withTimeout(1)); |
| 295 | + } |
| 296 | + |
| 297 | + /** |
| 298 | + * @dataProvider connectionAliases |
| 299 | + */ |
| 300 | + public function testLongQueryUnmanaged(string $alias): void |
| 301 | + { |
| 302 | + $tsx = $this->client->beginTransaction([], $alias, TransactionConfiguration::default()->withTimeout(100000)); |
| 303 | + $tsx->run('UNWIND range(1, 10000) AS x MERGE (:Number {value: x})'); |
| 304 | + self::assertTrue(true); |
| 305 | + } |
| 306 | + |
| 307 | + /** |
| 308 | + * @dataProvider connectionAliases |
| 309 | + */ |
| 310 | + public function testLongQueryUnmanagedNegative(string $alias): void |
| 311 | + { |
| 312 | + if (str_starts_with($alias, 'http')) { |
| 313 | + self::markTestSkipped('HTTP does not support tsx timeout at the moment.'); |
| 314 | + } |
| 315 | + |
| 316 | + $this->expectException(ConnectException::class); |
| 317 | + $tsx = $this->client->beginTransaction([], $alias, TransactionConfiguration::default()->withTimeout(1)); |
| 318 | + $tsx->run('UNWIND range(1, 10000) AS x MERGE (:Number {value: x})'); |
| 319 | + } |
280 | 320 | }
|
0 commit comments