18
18
use Symfony \Component \DependencyInjection \Container ;
19
19
use Symfony \Component \Filesystem \Filesystem ;
20
20
use 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 ;
21
26
22
27
class TranslationDebugCommandTest extends TestCase
23
28
{
@@ -101,7 +106,7 @@ public function testDebugCustomDirectory()
101
106
{
102
107
$ this ->fs ->mkdir ($ this ->translationDir .'/customDir/translations ' );
103
108
$ this ->fs ->mkdir ($ this ->translationDir .'/customDir/templates ' );
104
- $ kernel = $ this ->getMockBuilder (\ Symfony \ Component \ HttpKernel \ KernelInterface::class)-> getMock ( );
109
+ $ kernel = $ this ->createMock ( KernelInterface::class);
105
110
$ kernel ->expects ($ this ->once ())
106
111
->method ('getBundle ' )
107
112
->with ($ this ->equalTo ($ this ->translationDir .'/customDir ' ))
@@ -117,7 +122,7 @@ public function testDebugCustomDirectory()
117
122
public function testDebugInvalidDirectory ()
118
123
{
119
124
$ this ->expectException (\InvalidArgumentException::class);
120
- $ kernel = $ this ->getMockBuilder (\ Symfony \ Component \ HttpKernel \ KernelInterface::class)-> getMock ( );
125
+ $ kernel = $ this ->createMock ( KernelInterface::class);
121
126
$ kernel ->expects ($ this ->once ())
122
127
->method ('getBundle ' )
123
128
->with ($ this ->equalTo ('dir ' ))
@@ -142,16 +147,13 @@ protected function tearDown(): void
142
147
143
148
private function createCommandTester ($ extractedMessages = [], $ loadedMessages = [], $ kernel = null , array $ transPaths = [], array $ viewsPaths = []): CommandTester
144
149
{
145
- $ translator = $ this ->getMockBuilder (\Symfony \Component \Translation \Translator::class)
146
- ->disableOriginalConstructor ()
147
- ->getMock ();
148
-
150
+ $ translator = $ this ->createMock (Translator::class);
149
151
$ translator
150
152
->expects ($ this ->any ())
151
153
->method ('getFallbackLocales ' )
152
154
->willReturn (['en ' ]);
153
155
154
- $ extractor = $ this ->getMockBuilder (\ Symfony \ Component \ Translation \ Extractor \ ExtractorInterface::class)-> getMock ( );
156
+ $ extractor = $ this ->createMock ( ExtractorInterface::class);
155
157
$ extractor
156
158
->expects ($ this ->any ())
157
159
->method ('extract ' )
@@ -161,7 +163,7 @@ function ($path, $catalogue) use ($extractedMessages) {
161
163
}
162
164
);
163
165
164
- $ loader = $ this ->getMockBuilder (\ Symfony \ Component \ Translation \ Reader \ TranslationReader::class)-> getMock ( );
166
+ $ loader = $ this ->createMock ( TranslationReader::class);
165
167
$ loader
166
168
->expects ($ this ->any ())
167
169
->method ('read ' )
@@ -182,7 +184,7 @@ function ($path, $catalogue) use ($loadedMessages) {
182
184
['test ' , true , $ this ->getBundle ('test ' )],
183
185
];
184
186
}
185
- $ kernel = $ this ->getMockBuilder (\ Symfony \ Component \ HttpKernel \ KernelInterface::class)-> getMock ( );
187
+ $ kernel = $ this ->createMock ( KernelInterface::class);
186
188
$ kernel
187
189
->expects ($ this ->any ())
188
190
->method ('getBundle ' )
@@ -212,7 +214,7 @@ function ($path, $catalogue) use ($loadedMessages) {
212
214
213
215
private function getBundle ($ path )
214
216
{
215
- $ bundle = $ this ->getMockBuilder (\ Symfony \ Component \ HttpKernel \ Bundle \ BundleInterface::class)-> getMock ( );
217
+ $ bundle = $ this ->createMock ( BundleInterface::class);
216
218
$ bundle
217
219
->expects ($ this ->any ())
218
220
->method ('getPath ' )
0 commit comments