File tree Expand file tree Collapse file tree 4 files changed +47
-15
lines changed
Expand file tree Collapse file tree 4 files changed +47
-15
lines changed Original file line number Diff line number Diff line change 33namespace PhpSchool \PhpWorkshop \ExerciseCheck ;
44
55/**
6- * Interface ComposerExerciseCheck
6+ * This interface should be implemented when you require the check `PhpSchool\PhpWorkshop\Check\ComposerCheck` in your
7+ * exercise.
8+ *
79 * @package PhpSchool\PhpWorkshop\ExerciseCheck
810 */
911interface ComposerExerciseCheck
1012{
1113 /**
12- * @return array
14+ * Returns an array of composer package names that student's solution should
15+ * have required via composer.
16+ *
17+ * @return array An array of composer package names.
1318 */
1419 public function getRequiredPackages ();
1520}
Original file line number Diff line number Diff line change 55use PDO ;
66
77/**
8- * Interface DatabaseExerciseCheck
8+ * This interface should be implemented when you require the check `PhpSchool\PhpWorkshop\Check\DatabaseCheck` in your
9+ * exercise.
10+ *
911 * @package PhpSchool\PhpWorkshop\ExerciseCheck
1012 */
1113interface DatabaseExerciseCheck
1214{
1315 /**
14- * @param PDO $db
15- * @return bool
16+ * This method allows your exercise to seed the database *before* the solution's are executed. You can do anything
17+ * you normally could with a `PDO` object.
18+ *
19+ * @param PDO $db A `PDO` instance pointing to the database which will be accessible to the student's solution.
20+ * @return void
1621 */
17- public function verify (PDO $ db );
22+ public function seed (PDO $ db );
1823
1924 /**
20- * @param PDO $db
21- * @return void
25+ * This method allows your exercise to verify the state of database *after* the student's solution has been
26+ * executed. You can count rows in tables, check for the existence of tables & rows and of course anything else
27+ * you can do with a `PDO` object. The method should return a boolean indicating whether the verification
28+ * was successful or not.
29+ *
30+ * @param PDO $db A `PDO` instance pointing to the database which was accessible by the student's solution.
31+ * @return bool The result of the verification.
2232 */
23- public function seed (PDO $ db );
33+ public function verify (PDO $ db );
2434}
Original file line number Diff line number Diff line change 33namespace PhpSchool \PhpWorkshop \ExerciseCheck ;
44
55/**
6- * Interface FunctionRequirementsExerciseCheck
6+ * This interface should be implemented when you require the check
7+ * `PhpSchool\PhpWorkshop\Check\FunctionRequirementsCheck` in your exercise.
8+ *
79 * @package PhpSchool\PhpWorkshop\ExerciseCheck
810 */
911interface FunctionRequirementsExerciseCheck
1012{
1113 /**
12- * @return string[]
14+ * Returns an array of function names that the student's solution should use. The solution
15+ * will be parsed and checked for usages of these functions.
16+ *
17+ * @return string[] An array of function names that *should* be used.
1318 */
1419 public function getRequiredFunctions ();
1520
1621 /**
17- * @return string[]
22+ * Returns an array of function names that the student's solution should not use. The solution
23+ * will be parsed and checked for usages of these functions.
24+ *
25+ * @return string[] An array of function names that *should not* be used.
1826 */
1927 public function getBannedFunctions ();
2028}
Original file line number Diff line number Diff line change 55use PhpSchool \PhpWorkshop \Result \ResultInterface ;
66
77/**
8- * Class SelfCheck
8+ * When implemented in an exercise, this interface allows for an exercise to check it's self.
9+ * That is, perform additional verifications in the actual exercise class
10+ * itself. See [Self Checking Exercises](https://www.phpschool.io/docs/reference/self-checking-exercises) for more
11+ * information.
12+ *
13+ * Self checking runs *after* the student's solution has been run/verified.
14+ *
915 * @package PhpSchool\PhpWorkshop\ExerciseCheck
1016 * @author Aydin Hassan <aydin@hotmail.co.uk>
1117 */
1218interface SelfCheck
1319{
1420 /**
15- * @param string $fileName
16- * @return ResultInterface
21+ * The method is passed the absolute file path to the student's solution and should return a result
22+ * object which indicates the success or not of the check.
23+ *
24+ * @param string $fileName The absolute path to the student's submission.
25+ * @return ResultInterface The result of the check.
1726 */
1827 public function check ($ fileName );
1928}
You can’t perform that action at this time.
0 commit comments