@@ -97,9 +97,13 @@ public function testHandleManageJsonRpcMethodTag()
9797 $ methodName2 = 'my-method-name-2 ' ;
9898
9999 // A first method
100- $ this ->setDefinition ($ jsonRpcMethodServiceId , $ this ->createJsonRpcMethodDefinition ($ methodName ));
100+ $ methodService = $ this ->createJsonRpcMethodDefinition ();
101+ $ this ->addJsonRpcMethodTag ($ methodService , $ methodName );
102+ $ this ->setDefinition ($ jsonRpcMethodServiceId , $ methodService );
101103 // A second method
102- $ this ->setDefinition ($ jsonRpcMethodServiceId2 , $ this ->createJsonRpcMethodDefinition ($ methodName2 ));
104+ $ methodService2 = $ this ->createJsonRpcMethodDefinition ();
105+ $ this ->addJsonRpcMethodTag ($ methodService2 , $ methodName2 );
106+ $ this ->setDefinition ($ jsonRpcMethodServiceId2 , $ methodService2 );
103107
104108 $ this ->load ();
105109
@@ -135,9 +139,13 @@ public function testHandleNotManageJsonRpcMethodTagIfCustomResolverIsUsed()
135139 $ methodName2 = 'my-method-name-2 ' ;
136140
137141 // A first method
138- $ this ->setDefinition ($ jsonRpcMethodServiceId , $ this ->createJsonRpcMethodDefinition ($ methodName ));
142+ $ methodService = $ this ->createJsonRpcMethodDefinition ();
143+ $ this ->addJsonRpcMethodTag ($ methodService , $ methodName );
144+ $ this ->setDefinition ($ jsonRpcMethodServiceId , $ methodService );
139145 // A second method
140- $ this ->setDefinition ($ jsonRpcMethodServiceId2 , $ this ->createJsonRpcMethodDefinition ($ methodName2 ));
146+ $ methodService2 = $ this ->createJsonRpcMethodDefinition ();
147+ $ this ->addJsonRpcMethodTag ($ methodService2 , $ methodName2 );
148+ $ this ->setDefinition ($ jsonRpcMethodServiceId2 , $ methodService2 );
141149
142150 // Add the custom method resolver
143151 $ this ->setDefinition (uniqid (), $ this ->createCustomMethodResolverDefinition ());
@@ -157,19 +165,15 @@ public function testShouldThrowAnExceptionIfJsonRpcMethodUsedWithTagIsDoesNotHav
157165 $ jsonRpcMethodServiceId = uniqid ();
158166 $ jsonRpcMethodServiceId2 = uniqid ();
159167 $ methodName = 'my-method-name ' ;
160- $ methodName2 = 'my-method-name-2 ' ;
161168
162169 // A first method
163- $ this ->setDefinition ($ jsonRpcMethodServiceId , $ this ->createJsonRpcMethodDefinition ($ methodName ));
164- // A second method
165- $ this ->setDefinition (
166- $ jsonRpcMethodServiceId2 ,
167- $ this ->createJsonRpcMethodDefinition ($ methodName2 )
168- // Clear previous tag
169- ->clearTag (self ::EXPECTED_JSONRPC_METHOD_TAG )
170- // And add one without attribute
171- ->addTag (self ::EXPECTED_JSONRPC_METHOD_TAG )
172- );
170+ $ methodService = $ this ->createJsonRpcMethodDefinition ();
171+ $ this ->addJsonRpcMethodTag ($ methodService , $ methodName );
172+ $ this ->setDefinition ($ jsonRpcMethodServiceId , $ methodService );
173+ // A second method with empty tag attribute
174+ $ methodService2 = $ this ->createJsonRpcMethodDefinition ();
175+ $ methodService2 ->addTag (self ::EXPECTED_JSONRPC_METHOD_TAG );
176+ $ this ->setDefinition ($ jsonRpcMethodServiceId2 , $ methodService2 );
173177
174178 $ this ->expectException (LogicException::class);
175179 // Check that exception is for the second method
@@ -193,12 +197,13 @@ public function testShouldThrowAnExceptionIfJsonRpcMethodUsedWithTagIsNotPublic(
193197 $ methodName2 = 'my-method-name-2 ' ;
194198
195199 // A first method
196- $ this ->setDefinition ($ jsonRpcMethodServiceId , $ this ->createJsonRpcMethodDefinition ($ methodName ));
197- // A second method
198- $ this ->setDefinition (
199- $ jsonRpcMethodServiceId2 ,
200- $ this ->createJsonRpcMethodDefinition ($ methodName2 )->setPublic (false )
201- );
200+ $ methodService = $ this ->createJsonRpcMethodDefinition ();
201+ $ this ->addJsonRpcMethodTag ($ methodService , $ methodName );
202+ $ this ->setDefinition ($ jsonRpcMethodServiceId , $ methodService );
203+ // A second method with private service
204+ $ methodService2 = $ this ->createJsonRpcMethodDefinition ()->setPublic (false );
205+ $ this ->addJsonRpcMethodTag ($ methodService2 , $ methodName2 );
206+ $ this ->setDefinition ($ jsonRpcMethodServiceId2 , $ methodService2 );
202207
203208 $ this ->expectException (LogicException::class);
204209 // Check that exception is for the second method
0 commit comments