@@ -206,6 +206,8 @@ public function run(ExecutionContext $context, OutputInterface $output): bool
206206        $ scenario$ this exercise ->defineTestScenario ();
207207
208208        $ this environmentManager ->prepareStudent ($ context$ scenario
209+         $ this environmentManager ->prepareReference ($ context$ scenario
210+ 
209211
210212        $ this eventDispatcher ->dispatch (new  CliExerciseRunnerEvent ('cli.run.start ' , $ context$ scenario
211213
@@ -222,6 +224,7 @@ public function run(ExecutionContext $context, OutputInterface $output): bool
222224                $ contextgetStudentExecutionDirectory (),
223225                $ contextgetEntryPoint (),
224226                $ args
227+                 $ scenariogetExposedPorts (),
225228            );
226229
227230            $ processstart ();
@@ -231,6 +234,7 @@ public function run(ExecutionContext $context, OutputInterface $output): bool
231234            $ processwait (function  ($ outputType$ outputBufferuse  ($ output
232235                $ outputwrite ($ outputBuffer
233236            });
237+ 
234238            $ outputemptyLine ();
235239
236240            if  (!$ processisSuccessful ()) {
@@ -254,7 +258,7 @@ public function run(ExecutionContext $context, OutputInterface $output): bool
254258     */ 
255259    private  function  executePhpFile (ExecutionContext $ contextCliScenario $ scenariostring  $ workingDirectorystring  $ fileNameCollection $ argsstring  $ typestring 
256260    {
257-         $ process$ this getPhpProcess ($ workingDirectory$ fileName$ args
261+         $ process$ this getPhpProcess ($ workingDirectory$ fileName$ args,  $ scenario -> getExposedPorts () );
258262
259263        $ processstart ();
260264        $ this eventDispatcher ->dispatch (
@@ -271,11 +275,12 @@ private function executePhpFile(ExecutionContext $context, CliScenario $scenario
271275
272276    /** 
273277     * @param Collection<int, string> $args 
278+      * @param list<int> $exposedPorts 
274279     */ 
275-     private  function  getPhpProcess (string  $ workingDirectorystring  $ fileNameCollection $ argsProcess 
280+     private  function  getPhpProcess (string  $ workingDirectorystring  $ fileNameCollection $ args,  array   $ exposedPorts Process 
276281    {
277282        return  $ this processFactory ->create (
278-             new  ProcessInput ('php ' , [$ fileName$ argsgetArrayCopy ()], $ workingDirectory
283+             new  ProcessInput ('php ' , [$ fileName$ argsgetArrayCopy ()], $ workingDirectory,  $ exposedPorts 
279284        );
280285    }
281286}
0 commit comments