1111#[Small]
1212class ResourcesDefinitionCompilerPassTest extends TestCase
1313{
14- public function testProcessRegistersResourcesAsServices ()
14+ public function test_process_registers_resources_as_services ()
1515 {
1616 eval ('namespace App\Resource; class ResourceA {} ' );
1717 eval ('namespace App\Resource; class ResourceB {} ' );
@@ -21,12 +21,13 @@ public function testProcessRegistersResourcesAsServices()
2121
2222 $ invocations = [
2323 'klp_mcp_server.resources ' ,
24- 'klp_mcp_server.resources_templates '
24+ 'klp_mcp_server.resources_templates ' ,
2525 ];
2626 $ container ->expects ($ matcher = $ this ->exactly (2 ))
2727 ->method ('getParameter ' )
2828 ->with ($ this ->callback (function ($ argument ) use ($ invocations , $ matcher ) {
2929 $ this ->assertEquals ($ argument , $ invocations [$ matcher ->numberOfInvocations () - 1 ]);
30+
3031 return true ;
3132 }))
3233 ->willReturnOnConsecutiveCalls (
@@ -42,6 +43,7 @@ public function testProcessRegistersResourcesAsServices()
4243 ->method ('has ' )
4344 ->with ($ this ->callback (function ($ argument ) use ($ invocations , $ matcher ) {
4445 $ this ->assertEquals ($ argument , $ invocations [$ matcher ->numberOfInvocations () - 1 ]);
46+
4547 return true ;
4648 }))
4749 ->willReturnOnConsecutiveCalls (false , false );
@@ -50,26 +52,28 @@ public function testProcessRegistersResourcesAsServices()
5052 ->method ('setDefinition ' )
5153 ->with ($ this ->callback (function ($ argument ) use ($ invocations , $ matcher ) {
5254 $ this ->assertEquals ($ argument , $ invocations [$ matcher ->numberOfInvocations () - 1 ]);
55+
5356 return true ;
5457 }));
5558
56- $ pass = new ResourcesDefinitionCompilerPass () ;
59+ $ pass = new ResourcesDefinitionCompilerPass ;
5760 $ pass ->process ($ container );
5861 }
5962
60- public function testProcessDoesNotRegisterAlreadyDefinedResources ()
63+ public function test_process_does_not_register_already_defined_resources ()
6164 {
6265 $ container = $ this ->createMock (ContainerBuilder::class);
6366 $ resources = ['App\Resource\ExistingResource ' ];
6467
6568 $ invocations = [
6669 'klp_mcp_server.resources ' ,
67- 'klp_mcp_server.resources_templates '
70+ 'klp_mcp_server.resources_templates ' ,
6871 ];
6972 $ container ->expects ($ matcher = $ this ->exactly (count ($ invocations )))
7073 ->method ('getParameter ' )
7174 ->with ($ this ->callback (function ($ argument ) use ($ invocations , $ matcher ) {
7275 $ this ->assertEquals ($ argument , $ invocations [$ matcher ->numberOfInvocations () - 1 ]);
76+
7377 return true ;
7478 }))
7579 ->willReturnOnConsecutiveCalls (
@@ -85,24 +89,25 @@ public function testProcessDoesNotRegisterAlreadyDefinedResources()
8589 $ container ->expects ($ this ->never ())
8690 ->method ('setDefinition ' );
8791
88- $ pass = new ResourcesDefinitionCompilerPass () ;
92+ $ pass = new ResourcesDefinitionCompilerPass ;
8993 $ pass ->process ($ container );
9094 }
9195
92- public function testProcessAddsMethodCallToServer ()
96+ public function test_process_adds_method_call_to_server ()
9397 {
9498 $ container = $ this ->createMock (ContainerBuilder::class);
9599 $ serverDefinition = $ this ->createMock (Definition::class);
96100 $ resourceRepositoryDefinition = $ this ->createMock (Definition::class);
97101
98102 $ invocations = [
99103 'klp_mcp_server.resources ' ,
100- 'klp_mcp_server.resources_templates '
104+ 'klp_mcp_server.resources_templates ' ,
101105 ];
102106 $ container ->expects ($ matcher = $ this ->exactly (count ($ invocations )))
103107 ->method ('getParameter ' )
104108 ->with ($ this ->callback (function ($ argument ) use ($ invocations , $ matcher ) {
105109 $ this ->assertEquals ($ argument , $ invocations [$ matcher ->numberOfInvocations () - 1 ]);
110+
106111 return true ;
107112 }))
108113 ->willReturn ([]);
@@ -115,6 +120,7 @@ public function testProcessAddsMethodCallToServer()
115120 ->method ('getDefinition ' )
116121 ->with ($ this ->callback (function ($ argument ) use ($ invocations , $ matcher ) {
117122 $ this ->assertEquals ($ argument , $ invocations [$ matcher ->numberOfInvocations () - 1 ]);
123+
118124 return true ;
119125 }))
120126 ->willReturnOnConsecutiveCalls (
@@ -126,7 +132,7 @@ public function testProcessAddsMethodCallToServer()
126132 ->method ('addMethodCall ' )
127133 ->with ('registerResourceRepository ' , [$ resourceRepositoryDefinition ]);
128134
129- $ pass = new ResourcesDefinitionCompilerPass () ;
135+ $ pass = new ResourcesDefinitionCompilerPass ;
130136 $ pass ->process ($ container );
131137 }
132138}
0 commit comments