@@ -36,8 +36,7 @@ public function getName(): string
36
36
* installed a set of required packages. If they did not a failure is returned, otherwise,
37
37
* a success is returned.
38
38
*
39
- * @param ExerciseInterface $exercise The exercise to check against.
40
- * @param Input $input The command line arguments passed to the command.
39
+ * @param ExecutionContext $context The current execution context.
41
40
* @return ResultInterface The result of the check.
42
41
* @noinspection SpellCheckingInspection
43
42
*/
@@ -47,19 +46,19 @@ public function check(ExecutionContext $context): ResultInterface
47
46
throw new InvalidArgumentException ();
48
47
}
49
48
50
- if (!file_exists (sprintf ('%s/composer.json ' , dirname ( $ context ->input -> getRequiredArgument ( ' program ' )) ))) {
49
+ if (!file_exists (sprintf ('%s/composer.json ' , $ context ->studentEnvironment -> workingDirectory ))) {
51
50
return ComposerFailure::fromCheckAndMissingFileOrFolder ($ this , 'composer.json ' );
52
51
}
53
52
54
- if (!file_exists (sprintf ('%s/composer.lock ' , dirname ( $ context ->input -> getRequiredArgument ( ' program ' )) ))) {
53
+ if (!file_exists (sprintf ('%s/composer.lock ' , $ context ->studentEnvironment -> workingDirectory ))) {
55
54
return ComposerFailure::fromCheckAndMissingFileOrFolder ($ this , 'composer.lock ' );
56
55
}
57
56
58
- if (!file_exists (sprintf ('%s/vendor ' , dirname ( $ context ->input -> getRequiredArgument ( ' program ' )) ))) {
57
+ if (!file_exists (sprintf ('%s/vendor ' , $ context ->studentEnvironment -> workingDirectory ))) {
59
58
return ComposerFailure::fromCheckAndMissingFileOrFolder ($ this , 'vendor ' );
60
59
}
61
60
62
- $ lockFile = new LockFileParser (sprintf ('%s/composer.lock ' , dirname ( $ context ->input -> getRequiredArgument ( ' program ' )) ));
61
+ $ lockFile = new LockFileParser (sprintf ('%s/composer.lock ' , $ context ->studentEnvironment -> workingDirectory ));
63
62
$ missingPackages = array_filter ($ context ->exercise ->getRequiredPackages (), function ($ package ) use ($ lockFile ) {
64
63
return !$ lockFile ->hasInstalledPackage ($ package );
65
64
});
0 commit comments