From ff18a69e261b17f6aae7b19dcb76f24cf7e2a3d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Andrieu?= Date: Sat, 11 May 2019 11:09:41 +0200 Subject: [PATCH] Improved events --- src/SymfonyCircuitBreaker.php | 2 +- tests/CircuitBreakerTestCase.php | 2 +- tests/SymfonyCircuitBreakerEventsTest.php | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/SymfonyCircuitBreaker.php b/src/SymfonyCircuitBreaker.php index 276b5c6..2f12271 100644 --- a/src/SymfonyCircuitBreaker.php +++ b/src/SymfonyCircuitBreaker.php @@ -120,7 +120,7 @@ private function dispatch($eventName, $service, array $parameters): object return $this->eventDispatcher ->dispatch( - $eventName, + 'resiliency.' . strtolower($eventName), $event ) ; diff --git a/tests/CircuitBreakerTestCase.php b/tests/CircuitBreakerTestCase.php index 85d58fd..fd050ca 100644 --- a/tests/CircuitBreakerTestCase.php +++ b/tests/CircuitBreakerTestCase.php @@ -22,7 +22,7 @@ abstract class CircuitBreakerTestCase extends TestCase * * @return GuzzleClient */ - protected function getTestClient() : GuzzleClient + protected function getTestClient(): GuzzleClient { $mock = new MockHandler([ new RequestException('Service unavailable', new Request('GET', 'test')), diff --git a/tests/SymfonyCircuitBreakerEventsTest.php b/tests/SymfonyCircuitBreakerEventsTest.php index 96b8686..6e30f27 100644 --- a/tests/SymfonyCircuitBreakerEventsTest.php +++ b/tests/SymfonyCircuitBreakerEventsTest.php @@ -41,10 +41,10 @@ function () { $invocations = $this->spy->getInvocations(); $this->assertCount(4, $invocations); - $this->assertSame('INITIATING', $invocations[0]->getParameters()[0]); - $this->assertSame('TRIAL', $invocations[1]->getParameters()[0]); - $this->assertSame('TRIAL', $invocations[2]->getParameters()[0]); - $this->assertSame('OPENING', $invocations[3]->getParameters()[0]); + $this->assertSame('resiliency.initiating', $invocations[0]->getParameters()[0]); + $this->assertSame('resiliency.trial', $invocations[1]->getParameters()[0]); + $this->assertSame('resiliency.trial', $invocations[2]->getParameters()[0]); + $this->assertSame('resiliency.opening', $invocations[3]->getParameters()[0]); } private function createCircuitBreaker(): SymfonyCircuitBreaker