88use PhpSchool \PhpWorkshop \Check \SimpleCheckInterface ;
99use PhpSchool \PhpWorkshop \Event \Event ;
1010use PhpSchool \PhpWorkshop \Event \EventDispatcher ;
11+ use PhpSchool \PhpWorkshop \Event \ExerciseRunnerEvent ;
1112use PhpSchool \PhpWorkshop \Exception \CheckNotApplicableException ;
1213use PhpSchool \PhpWorkshop \Exception \ExerciseNotConfiguredException ;
1314use PhpSchool \PhpWorkshop \Exception \InvalidArgumentException ;
@@ -136,7 +137,7 @@ public function verify(ExerciseInterface $exercise, Input $input)
136137 $ this ->requireCheck ($ requiredCheck );
137138 }
138139
139- $ this ->eventDispatcher ->dispatch (new Event ('verify.start ' , compact ( ' exercise ' , ' input ' ) ));
140+ $ this ->eventDispatcher ->dispatch (new ExerciseRunnerEvent ('verify.start ' , $ exercise, $ input ));
140141
141142 $ this ->validateChecks ($ this ->checksToRunBefore , $ exercise );
142143 $ this ->validateChecks ($ this ->checksToRunAfter , $ exercise );
@@ -149,22 +150,22 @@ public function verify(ExerciseInterface $exercise, Input $input)
149150 }
150151 }
151152
152- $ this ->eventDispatcher ->dispatch (new Event ('verify.pre.execute ' , compact ( ' exercise ' , ' input ' ) ));
153+ $ this ->eventDispatcher ->dispatch (new ExerciseRunnerEvent ('verify.pre.execute ' , $ exercise, $ input ));
153154
154155 try {
155156 $ this ->results ->add ($ runner ->verify ($ input ));
156157 } finally {
157- $ this ->eventDispatcher ->dispatch (new Event ('verify.post.execute ' , compact ( ' exercise ' , ' input ' ) ));
158+ $ this ->eventDispatcher ->dispatch (new ExerciseRunnerEvent ('verify.post.execute ' , $ exercise, $ input ));
158159 }
159160
160161 foreach ($ this ->checksToRunAfter as $ check ) {
161162 $ this ->results ->add ($ check ->check ($ exercise , $ input ));
162163 }
163164
164- $ this ->eventDispatcher ->dispatch (new Event ('verify.post.check ' , compact ( ' exercise ' , ' input ' ) ));
165+ $ this ->eventDispatcher ->dispatch (new ExerciseRunnerEvent ('verify.post.check ' , $ exercise, $ input ));
165166 $ exercise ->tearDown ();
166167
167- $ this ->eventDispatcher ->dispatch (new Event ('verify.finish ' , compact ( ' exercise ' , ' input ' ) ));
168+ $ this ->eventDispatcher ->dispatch (new ExerciseRunnerEvent ('verify.finish ' , $ exercise, $ input ));
168169 return $ this ->results ;
169170 }
170171
@@ -181,14 +182,14 @@ public function verify(ExerciseInterface $exercise, Input $input)
181182 public function run (ExerciseInterface $ exercise , Input $ input , OutputInterface $ output )
182183 {
183184 $ exercise ->configure ($ this );
184- $ this ->eventDispatcher ->dispatch (new Event ('run.start ' , compact ( ' exercise ' , ' input ' ) ));
185+ $ this ->eventDispatcher ->dispatch (new ExerciseRunnerEvent ('run.start ' , $ exercise, $ input ));
185186
186187 try {
187188 $ exitStatus = $ this ->runnerManager
188189 ->getRunner ($ exercise )
189190 ->run ($ input , $ output );
190191 } finally {
191- $ this ->eventDispatcher ->dispatch (new Event ('run.finish ' , compact ( ' exercise ' , ' input ' ) ));
192+ $ this ->eventDispatcher ->dispatch (new ExerciseRunnerEvent ('run.finish ' , $ exercise, $ input ));
192193 }
193194
194195 return $ exitStatus ;
0 commit comments