File tree Expand file tree Collapse file tree 4 files changed +29
-3
lines changed
tests/Functional/DependencyInjection Expand file tree Collapse file tree 4 files changed +29
-3
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,9 @@ public function getConfigTreeBuilder()
26
26
->addDefaultsIfNotSet ()
27
27
->children ()
28
28
->booleanNode ('enabled ' )
29
- ->info ('Whether to render debug information on error or not (should NOT be enabled on prod) ' )
29
+ ->info (
30
+ 'Whether to render debug information on error or not (should NOT be enabled on prod) '
31
+ )
30
32
->defaultFalse ()
31
33
->end ()
32
34
->integerNode ('max_trace_size ' )
Original file line number Diff line number Diff line change @@ -230,8 +230,8 @@ private function checkMethodAwareServiceIdList(
230
230
private function bindDebug (ContainerBuilder $ container ) : void
231
231
{
232
232
if ($ container ->getParameter (self ::EXTENSION_IDENTIFIER .'.debug.enabled ' )) {
233
- $ container ->getDefinition (self :: EXTENSION_IDENTIFIER . ' .app.serialization.jsonrpc_response_normalizer ' )
234
- ->addArgument (new Reference (self :: EXTENSION_IDENTIFIER . ' .app.serialization.jsonrpc_response_error_normalizer ' ));
233
+ $ container ->getDefinition (' json_rpc_server_sdk .app.serialization.jsonrpc_response_normalizer ' )
234
+ ->addArgument (new Reference (' json_rpc_server_sdk .app.serialization.jsonrpc_response_error_normalizer ' ));
235
235
}
236
236
}
237
237
}
Original file line number Diff line number Diff line change 11
11
use Yoanm \JsonRpcServer \App \Serialization \JsonRpcCallSerializer ;
12
12
use Yoanm \JsonRpcServer \App \Serialization \JsonRpcRequestDenormalizer ;
13
13
use Yoanm \JsonRpcServer \App \Serialization \JsonRpcResponseNormalizer ;
14
+ use Yoanm \JsonRpcServer \App \Serialization \JsonRpcResponseErrorNormalizer ;
14
15
use Yoanm \JsonRpcServer \Infra \Endpoint \JsonRpcEndpoint ;
15
16
use Yoanm \SymfonyJsonRpcHttpServer \DependencyInjection \JsonRpcHttpServerExtension ;
16
17
use Yoanm \SymfonyJsonRpcHttpServer \Dispatcher \SymfonyJsonRpcServerDispatcher ;
@@ -100,6 +101,11 @@ public function provideSDKAppServiceIdAndClass()
100
101
'serviceClassName ' => ResponseCreator::class,
101
102
'public ' => false ,
102
103
],
104
+ 'SDK - App - Response error normalizer ' => [
105
+ 'serviceId ' => 'json_rpc_server_sdk.app.serialization.jsonrpc_response_error_normalizer ' ,
106
+ 'serviceClassName ' => JsonRpcResponseErrorNormalizer::class,
107
+ 'public ' => false ,
108
+ ],
103
109
];
104
110
}
105
111
Original file line number Diff line number Diff line change @@ -185,4 +185,22 @@ public function testShouldThowAnExceptionIfMethodAwareServiceDoesNotImplementRig
185
185
186
186
$ this ->loadContainer ();
187
187
}
188
+
189
+ public function testShouldAddDebugResponseErrorNormalizerIfDebugModeEnabled ()
190
+ {
191
+ $ this ->loadContainer ([
192
+ 'debug ' => [
193
+ 'enabled ' => true ,
194
+ ]
195
+ ]);
196
+
197
+ // Assert response normalizer has responseErrorNormalizer as first argument
198
+ $ this ->assertContainerBuilderHasServiceDefinitionWithArgument (
199
+ 'json_rpc_server_sdk.app.serialization.jsonrpc_response_normalizer ' ,
200
+ 0 ,
201
+ new Reference ('json_rpc_server_sdk.app.serialization.jsonrpc_response_error_normalizer ' ),
202
+ );
203
+
204
+ $ this ->assertEndpointIsUsable ();
205
+ }
188
206
}
You can’t perform that action at this time.
0 commit comments