1414
1515namespace Humbug \PhpScoper \Console \Command ;
1616
17- use Fidry \Console \Application \ SymfonyApplication ;
17+ use Fidry \Console \Test \ AppTester ;
1818use Humbug \PhpScoper \Console \Application ;
1919use Humbug \PhpScoper \Console \AppTesterAbilities ;
2020use Humbug \PhpScoper \Console \AppTesterTestCase ;
2121use Humbug \PhpScoper \Container ;
2222use Humbug \PhpScoper \FileSystemTestCase ;
23- use Symfony \Component \Console \Tester \ApplicationTester ;
2423use Symfony \Component \Finder \Finder ;
2524use Symfony \Component \Finder \SplFileInfo ;
2625use function array_reduce ;
4140 */
4241class AddPrefixCommandIntegrationTest extends FileSystemTestCase implements AppTesterTestCase
4342{
44- use AppTesterAbilities {
45- getNormalizeDisplay as getBaseNormalizeDisplay;
46- }
43+ use AppTesterAbilities;
4744
4845 private const FIXTURE_PATH = __DIR__ .'/../../../fixtures/set002/original ' ;
4946
@@ -59,9 +56,7 @@ protected function setUp(): void
5956 false ,
6057 );
6158
62- $ this ->appTester = new ApplicationTester (
63- new SymfonyApplication ($ application ),
64- );
59+ $ this ->appTester = AppTester::fromConsoleApp ($ application );
6560
6661 file_put_contents ('scoper.inc.php ' , '<?php return []; ' );
6762 }
@@ -164,6 +159,7 @@ public function test_scope_in_normal_mode(): void
164159 $ this ->assertExpectedOutput (
165160 $ expected ,
166161 0 ,
162+ $ this ->createDisplayNormalizer (),
167163 $ extraNormalization ,
168164 );
169165 }
@@ -210,7 +206,11 @@ public function test_scope_in_verbose_mode(): void
210206
211207EOF;
212208
213- $ this ->assertExpectedOutput ($ expected , 0 );
209+ $ this ->assertExpectedOutput (
210+ $ expected ,
211+ 0 ,
212+ $ this ->createDisplayNormalizer (),
213+ );
214214 }
215215
216216 public function test_scope_in_very_verbose_mode (): void
@@ -291,17 +291,24 @@ public function test_scope_in_very_verbose_mode(): void
291291 $ this ->assertExpectedOutput (
292292 $ expected ,
293293 0 ,
294+ $ this ->createDisplayNormalizer (),
294295 $ extraDisplayNormalization ,
295296 );
296297 }
297298
298- private function getNormalizeDisplay (string $ display , ?callable $ extraNormalization = null ): string
299+ /**
300+ * @return callable(string):string
301+ */
302+ private function createDisplayNormalizer (): callable
303+ {
304+ return fn ($ display ) => $ this ->getNormalizeDisplay ($ display );
305+ }
306+
307+ private function getNormalizeDisplay (string $ display ): string
299308 {
300309 $ display = str_replace (realpath (self ::FIXTURE_PATH ), '/path/to ' , $ display );
301310 $ display = str_replace ($ this ->tmp , '/path/to ' , $ display );
302311
303- $ display = $ this ->getBaseNormalizeDisplay ($ display , $ extraNormalization );
304-
305312 return preg_replace (
306313 '/\/\/ Memory usage: \d+\.\d{2}MB \(peak: \d+\.\d{2}MB\), time: \d+\.\d{2}s/ ' ,
307314 '// Memory usage: 5.00MB (peak: 10.00MB), time: 0.00s ' ,
0 commit comments