1818use Symfony \Component \DependencyInjection \Container ;
1919use Symfony \Component \Filesystem \Filesystem ;
2020use Symfony \Component \HttpKernel ;
21+ use Symfony \Component \HttpKernel \Bundle \BundleInterface ;
22+ use Symfony \Component \HttpKernel \KernelInterface ;
23+ use Symfony \Component \Translation \Extractor \ExtractorInterface ;
24+ use Symfony \Component \Translation \Reader \TranslationReader ;
25+ use Symfony \Component \Translation \Translator ;
2126
2227class TranslationDebugCommandTest extends TestCase
2328{
@@ -101,7 +106,7 @@ public function testDebugCustomDirectory()
101106 {
102107 $ this ->fs ->mkdir ($ this ->translationDir .'/customDir/translations ' );
103108 $ this ->fs ->mkdir ($ this ->translationDir .'/customDir/templates ' );
104- $ kernel = $ this ->getMockBuilder (\ Symfony \ Component \ HttpKernel \ KernelInterface::class)-> getMock ( );
109+ $ kernel = $ this ->createMock ( KernelInterface::class);
105110 $ kernel ->expects ($ this ->once ())
106111 ->method ('getBundle ' )
107112 ->with ($ this ->equalTo ($ this ->translationDir .'/customDir ' ))
@@ -117,7 +122,7 @@ public function testDebugCustomDirectory()
117122 public function testDebugInvalidDirectory ()
118123 {
119124 $ this ->expectException (\InvalidArgumentException::class);
120- $ kernel = $ this ->getMockBuilder (\ Symfony \ Component \ HttpKernel \ KernelInterface::class)-> getMock ( );
125+ $ kernel = $ this ->createMock ( KernelInterface::class);
121126 $ kernel ->expects ($ this ->once ())
122127 ->method ('getBundle ' )
123128 ->with ($ this ->equalTo ('dir ' ))
@@ -142,16 +147,13 @@ protected function tearDown(): void
142147
143148 private function createCommandTester ($ extractedMessages = [], $ loadedMessages = [], $ kernel = null , array $ transPaths = [], array $ viewsPaths = []): CommandTester
144149 {
145- $ translator = $ this ->getMockBuilder (\Symfony \Component \Translation \Translator::class)
146- ->disableOriginalConstructor ()
147- ->getMock ();
148-
150+ $ translator = $ this ->createMock (Translator::class);
149151 $ translator
150152 ->expects ($ this ->any ())
151153 ->method ('getFallbackLocales ' )
152154 ->willReturn (['en ' ]);
153155
154- $ extractor = $ this ->getMockBuilder (\ Symfony \ Component \ Translation \ Extractor \ ExtractorInterface::class)-> getMock ( );
156+ $ extractor = $ this ->createMock ( ExtractorInterface::class);
155157 $ extractor
156158 ->expects ($ this ->any ())
157159 ->method ('extract ' )
@@ -161,7 +163,7 @@ function ($path, $catalogue) use ($extractedMessages) {
161163 }
162164 );
163165
164- $ loader = $ this ->getMockBuilder (\ Symfony \ Component \ Translation \ Reader \ TranslationReader::class)-> getMock ( );
166+ $ loader = $ this ->createMock ( TranslationReader::class);
165167 $ loader
166168 ->expects ($ this ->any ())
167169 ->method ('read ' )
@@ -182,7 +184,7 @@ function ($path, $catalogue) use ($loadedMessages) {
182184 ['test ' , true , $ this ->getBundle ('test ' )],
183185 ];
184186 }
185- $ kernel = $ this ->getMockBuilder (\ Symfony \ Component \ HttpKernel \ KernelInterface::class)-> getMock ( );
187+ $ kernel = $ this ->createMock ( KernelInterface::class);
186188 $ kernel
187189 ->expects ($ this ->any ())
188190 ->method ('getBundle ' )
@@ -212,7 +214,7 @@ function ($path, $catalogue) use ($loadedMessages) {
212214
213215 private function getBundle ($ path )
214216 {
215- $ bundle = $ this ->getMockBuilder (\ Symfony \ Component \ HttpKernel \ Bundle \ BundleInterface::class)-> getMock ( );
217+ $ bundle = $ this ->createMock ( BundleInterface::class);
216218 $ bundle
217219 ->expects ($ this ->any ())
218220 ->method ('getPath ' )
0 commit comments