88use PhpMyAdmin \Config ;
99use PhpMyAdmin \Tests \AbstractTestCase ;
1010use PHPUnit \Framework \Attributes \CoversClass ;
11+ use ReflectionMethod ;
1112use Symfony \Component \Console \Command \Command ;
1213use Twig \Error \SyntaxError ;
1314
@@ -39,7 +40,7 @@ protected function setUp(): void
3940
4041 public function testGetTemplateContents (): void
4142 {
42- $ contents = $ this -> callFunction ( $ this -> command , TwigLintCommand::class, 'getTemplateContents ' , [
43+ $ contents = ( new ReflectionMethod ( TwigLintCommand::class, 'getTemplateContents ' ))-> invokeArgs ( $ this -> command , [
4344 __DIR__ . '/../_data/file_listing/subfolder/one.ini ' ,
4445 ]);
4546
@@ -49,7 +50,7 @@ public function testGetTemplateContents(): void
4950 public function testFindFiles (): void
5051 {
5152 $ path = __DIR__ . '/../_data/file_listing ' ;
52- $ filesFound = $ this -> callFunction ( $ this -> command , TwigLintCommand::class, 'findFiles ' , [$ path ]);
53+ $ filesFound = ( new ReflectionMethod ( TwigLintCommand::class, 'findFiles ' ))-> invokeArgs ( $ this -> command , [$ path ]);
5354
5455 // Sort results to avoid file system test specific failures
5556 sort ($ filesFound , SORT_NATURAL );
@@ -65,7 +66,8 @@ public function testFindFiles(): void
6566 public function testGetFilesInfo (): void
6667 {
6768 $ path = __DIR__ . '/../_data/file_listing ' ;
68- $ filesInfos = $ this ->callFunction ($ this ->command , TwigLintCommand::class, 'getFilesInfo ' , [$ path ]);
69+ $ filesInfos = (new ReflectionMethod (TwigLintCommand::class, 'getFilesInfo ' ))
70+ ->invokeArgs ($ this ->command , [$ path ]);
6971
7072 // Sort results to avoid file system test specific failures
7173 sort ($ filesInfos , SORT_REGULAR );
@@ -107,15 +109,18 @@ public function testGetFilesInfoInvalidFile(): void
107109
108110 public function testGetContext (): void
109111 {
110- $ context = $ this ->callFunction ($ this ->command , TwigLintCommand::class, 'getContext ' , ['{{ file } ' , 0 ]);
112+ $ context = (new ReflectionMethod (TwigLintCommand::class, 'getContext ' ))
113+ ->invokeArgs ($ this ->command , ['{{ file } ' , 0 ]);
111114
112115 self ::assertSame ([1 => '{{ file } ' ], $ context );
113116
114- $ context = $ this ->callFunction ($ this ->command , TwigLintCommand::class, 'getContext ' , ['{{ file } ' , 3 ]);
117+ $ context = (new ReflectionMethod (TwigLintCommand::class, 'getContext ' ))
118+ ->invokeArgs ($ this ->command , ['{{ file } ' , 3 ]);
115119
116120 self ::assertSame ([1 => '{{ file } ' ], $ context );
117121
118- $ context = $ this ->callFunction ($ this ->command , TwigLintCommand::class, 'getContext ' , ['{{ file } ' , 5 ]);
122+ $ context = (new ReflectionMethod (TwigLintCommand::class, 'getContext ' ))
123+ ->invokeArgs ($ this ->command , ['{{ file } ' , 5 ]);
119124
120125 self ::assertSame ([], $ context );
121126 }
0 commit comments