From 2b28a7a0383e84b5867effbb8791ec89f09ff4dc Mon Sep 17 00:00:00 2001 From: Serg Lifinsky Date: Mon, 21 Oct 2024 13:50:45 +0300 Subject: [PATCH] Fix InstantRetryInterceptor definition --- .../InstantRetry/InstantRetryInterceptor.php | 2 +- .../Ecotone/tests/Messaging/BaseEcotoneTest.php | 2 +- .../InstantRetry/InstantRetryModuleTest.php | 16 +++++++++++++--- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/packages/Ecotone/src/Modelling/Config/InstantRetry/InstantRetryInterceptor.php b/packages/Ecotone/src/Modelling/Config/InstantRetry/InstantRetryInterceptor.php index d00c6bef0..71d3f4593 100644 --- a/packages/Ecotone/src/Modelling/Config/InstantRetry/InstantRetryInterceptor.php +++ b/packages/Ecotone/src/Modelling/Config/InstantRetry/InstantRetryInterceptor.php @@ -74,6 +74,6 @@ private function canRetryThrownException(Exception $thrownException): bool public function getDefinition(): Definition { - return new Definition(self::class, [$this->maxRetryAttempts]); + return new Definition(self::class, [$this->maxRetryAttempts, $this->exceptions]); } } diff --git a/packages/Ecotone/tests/Messaging/BaseEcotoneTest.php b/packages/Ecotone/tests/Messaging/BaseEcotoneTest.php index 180da53af..0dc9d3536 100644 --- a/packages/Ecotone/tests/Messaging/BaseEcotoneTest.php +++ b/packages/Ecotone/tests/Messaging/BaseEcotoneTest.php @@ -9,7 +9,7 @@ /** * @internal */ -class BaseEcotoneTest extends TestCase +abstract class BaseEcotoneTest extends TestCase { /** * @dataProvider enterpriseMode diff --git a/packages/Ecotone/tests/Modelling/Unit/Config/InstantRetry/InstantRetryModuleTest.php b/packages/Ecotone/tests/Modelling/Unit/Config/InstantRetry/InstantRetryModuleTest.php index ff0b5aa08..d4c97fd22 100644 --- a/packages/Ecotone/tests/Modelling/Unit/Config/InstantRetry/InstantRetryModuleTest.php +++ b/packages/Ecotone/tests/Modelling/Unit/Config/InstantRetry/InstantRetryModuleTest.php @@ -101,9 +101,19 @@ public function test_retrying_with_command_bus_for_concrete_exception_when_diffe ]) ); - $this->expectException(RuntimeException::class); - - $ecotoneLite->sendCommandWithRoutingKey('retried.synchronous', 2); + $exceptionThrown = false; + try { + $ecotoneLite->sendCommandWithRoutingKey('retried.synchronous', 2); + } catch (RuntimeException $e) { + $exceptionThrown = true; + $this->assertInstanceOf(RuntimeException::class, $e); + } + + if (!$exceptionThrown) { + $this->fail('RuntimeException was not thrown'); + } + + $this->assertEquals(1, $ecotoneLite->sendQueryWithRouting('retried.getCallCount')); } public function test_retrying_with_asynchronous_handler()