8
8
use PhpSchool \PhpWorkshop \Check \SimpleCheckInterface ;
9
9
use PhpSchool \PhpWorkshop \Event \Event ;
10
10
use PhpSchool \PhpWorkshop \Event \EventDispatcher ;
11
+ use PhpSchool \PhpWorkshop \Event \ExerciseRunnerEvent ;
11
12
use PhpSchool \PhpWorkshop \Exception \CheckNotApplicableException ;
12
13
use PhpSchool \PhpWorkshop \Exception \ExerciseNotConfiguredException ;
13
14
use PhpSchool \PhpWorkshop \Exception \InvalidArgumentException ;
@@ -136,7 +137,7 @@ public function verify(ExerciseInterface $exercise, Input $input)
136
137
$ this ->requireCheck ($ requiredCheck );
137
138
}
138
139
139
- $ this ->eventDispatcher ->dispatch (new Event ('verify.start ' , compact ( ' exercise ' , ' input ' ) ));
140
+ $ this ->eventDispatcher ->dispatch (new ExerciseRunnerEvent ('verify.start ' , $ exercise, $ input ));
140
141
141
142
$ this ->validateChecks ($ this ->checksToRunBefore , $ exercise );
142
143
$ this ->validateChecks ($ this ->checksToRunAfter , $ exercise );
@@ -149,22 +150,22 @@ public function verify(ExerciseInterface $exercise, Input $input)
149
150
}
150
151
}
151
152
152
- $ this ->eventDispatcher ->dispatch (new Event ('verify.pre.execute ' , compact ( ' exercise ' , ' input ' ) ));
153
+ $ this ->eventDispatcher ->dispatch (new ExerciseRunnerEvent ('verify.pre.execute ' , $ exercise, $ input ));
153
154
154
155
try {
155
156
$ this ->results ->add ($ runner ->verify ($ input ));
156
157
} finally {
157
- $ this ->eventDispatcher ->dispatch (new Event ('verify.post.execute ' , compact ( ' exercise ' , ' input ' ) ));
158
+ $ this ->eventDispatcher ->dispatch (new ExerciseRunnerEvent ('verify.post.execute ' , $ exercise, $ input ));
158
159
}
159
160
160
161
foreach ($ this ->checksToRunAfter as $ check ) {
161
162
$ this ->results ->add ($ check ->check ($ exercise , $ input ));
162
163
}
163
164
164
- $ this ->eventDispatcher ->dispatch (new Event ('verify.post.check ' , compact ( ' exercise ' , ' input ' ) ));
165
+ $ this ->eventDispatcher ->dispatch (new ExerciseRunnerEvent ('verify.post.check ' , $ exercise, $ input ));
165
166
$ exercise ->tearDown ();
166
167
167
- $ this ->eventDispatcher ->dispatch (new Event ('verify.finish ' , compact ( ' exercise ' , ' input ' ) ));
168
+ $ this ->eventDispatcher ->dispatch (new ExerciseRunnerEvent ('verify.finish ' , $ exercise, $ input ));
168
169
return $ this ->results ;
169
170
}
170
171
@@ -181,14 +182,14 @@ public function verify(ExerciseInterface $exercise, Input $input)
181
182
public function run (ExerciseInterface $ exercise , Input $ input , OutputInterface $ output )
182
183
{
183
184
$ exercise ->configure ($ this );
184
- $ this ->eventDispatcher ->dispatch (new Event ('run.start ' , compact ( ' exercise ' , ' input ' ) ));
185
+ $ this ->eventDispatcher ->dispatch (new ExerciseRunnerEvent ('run.start ' , $ exercise, $ input ));
185
186
186
187
try {
187
188
$ exitStatus = $ this ->runnerManager
188
189
->getRunner ($ exercise )
189
190
->run ($ input , $ output );
190
191
} finally {
191
- $ this ->eventDispatcher ->dispatch (new Event ('run.finish ' , compact ( ' exercise ' , ' input ' ) ));
192
+ $ this ->eventDispatcher ->dispatch (new ExerciseRunnerEvent ('run.finish ' , $ exercise, $ input ));
192
193
}
193
194
194
195
return $ exitStatus ;
0 commit comments