1313class SseTransportTest extends TestCase
1414{
1515 private LoggerInterface |MockObject $ loggerMock ;
16+
1617 private SseTransport $ instance ;
1718
1819 protected function setUp (): void
@@ -41,8 +42,8 @@ public function test_send_string_message(): void
4142
4243 // Assert
4344 $ this ->assertEquals (
44- 'event: message ' . PHP_EOL
45- . 'data: ' .$ message . PHP_EOL . PHP_EOL ,
45+ 'event: message ' . PHP_EOL
46+ .'data: ' .$ message. PHP_EOL . PHP_EOL ,
4647 $ output
4748 );
4849 }
@@ -63,8 +64,8 @@ public function test_initialize_generates_client_id_and_sends_endpoint(): void
6364
6465 // Assert
6566 $ expectedClientId = $ this ->getProtectedProperty ($ this ->instance , 'clientId ' );
66- $ expectedOutput = 'event: endpoint ' . PHP_EOL
67- . 'data: /default-path/message?sessionId= ' . $ expectedClientId . PHP_EOL . PHP_EOL ;
67+ $ expectedOutput = 'event: endpoint ' . PHP_EOL
68+ .'data: /default-path/message?sessionId= ' . $ expectedClientId. PHP_EOL . PHP_EOL ;
6869
6970 $ this ->assertNotNull ($ expectedClientId );
7071 $ this ->assertEquals ($ expectedOutput , $ output );
@@ -73,7 +74,7 @@ public function test_initialize_generates_client_id_and_sends_endpoint(): void
7374 /**
7475 * Test that initialize does not overwrite an existing client ID.
7576 */
76- public function test_initializeD_does_not_overwrite_existing_client_id (): void
77+ public function test_initialize_d_does_not_overwrite_existing_client_id (): void
7778 {
7879 // Arrange
7980 $ existingClientId = 'predefined-client-id ' ;
@@ -90,8 +91,8 @@ public function test_initializeD_does_not_overwrite_existing_client_id(): void
9091
9192 // Assert
9293 $ currentClientId = $ this ->getProtectedProperty ($ this ->instance , 'clientId ' );
93- $ expectedOutput = 'event: endpoint ' . PHP_EOL
94- . 'data: /default-path/message?sessionId= ' . $ existingClientId . PHP_EOL . PHP_EOL ;
94+ $ expectedOutput = 'event: endpoint ' . PHP_EOL
95+ .'data: /default-path/message?sessionId= ' . $ existingClientId. PHP_EOL . PHP_EOL ;
9596
9697 $ this ->assertSame ($ existingClientId , $ currentClientId );
9798 $ this ->assertEquals ($ expectedOutput , $ output );
@@ -118,8 +119,8 @@ public function test_send_array_message(): void
118119
119120 // Assert
120121 $ this ->assertEquals (
121- 'event: message ' . PHP_EOL
122- . 'data: ' .$ messageJson . PHP_EOL . PHP_EOL ,
122+ 'event: message ' . PHP_EOL
123+ .'data: ' .$ messageJson. PHP_EOL . PHP_EOL ,
123124 $ output
124125 );
125126 }
@@ -132,7 +133,7 @@ private function getProtectedProperty(SseTransport $instance, string $propertyNa
132133 return $ prop ->getValue ($ instance );
133134 }
134135
135- private function setProtectedProperty (SseTransport $ instance , string $ propertyName , string $ propertyValue ):void
136+ private function setProtectedProperty (SseTransport $ instance , string $ propertyName , string $ propertyValue ): void
136137 {
137138 $ reflection = new \ReflectionClass ($ instance );
138139 $ prop = $ reflection ->getProperty ($ propertyName );
@@ -242,8 +243,8 @@ public function test_close_sends_close_event(): void
242243
243244 // Assert
244245 $ this ->assertEquals (
245- 'event: close ' . PHP_EOL
246- . 'data: {"reason":"server_closed"} ' . PHP_EOL . PHP_EOL ,
246+ 'event: close ' . PHP_EOL
247+ .'data: {"reason":"server_closed"} ' . PHP_EOL . PHP_EOL ,
247248 $ output
248249 );
249250 }
@@ -278,12 +279,13 @@ public function test_close_logs_exceptions_in_handlers_or_cleanup(): void
278279 $ this ->setProtectedProperty ($ this ->instance , 'connected ' , true );
279280 $ invocations = [
280281 'Error in SSE close handler: Handler Exception ' ,
281- 'Error cleaning up SSE adapter resources on close: Adapter Exception '
282+ 'Error cleaning up SSE adapter resources on close: Adapter Exception ' ,
282283 ];
283284 $ this ->loggerMock ->expects ($ matcher = $ this ->exactly (2 ))
284285 ->method ('error ' )
285286 ->with ($ this ->callback (function ($ arg ) use (&$ invocations , $ matcher ) {
286287 $ this ->assertEquals ($ arg , $ invocations [$ matcher ->numberOfInvocations () - 1 ]);
288+
287289 return true ;
288290 }));
289291
0 commit comments