Skip to content

Commit b35826f

Browse files
committed
Make it easier to mock the required checks for unit testing
1 parent 7da0f24 commit b35826f

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

src/ExerciseRunner/CgiRunner.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,15 @@ class CgiRunner implements ExerciseRunnerInterface
5050
*/
5151
private $requestRenderer;
5252

53+
/**
54+
* @var array
55+
*/
56+
private static $requiredChecks = [
57+
FileExistsCheck::class,
58+
PhpLintCheck::class,
59+
CodeParseCheck::class,
60+
];
61+
5362
/**
5463
* Requires the exercise instance and an event dispatcher. This runner requires the `php-cgi` binary to
5564
* be available. It will check for it's existence in the system's $PATH variable or the same
@@ -106,11 +115,7 @@ public function getName()
106115
*/
107116
public function getRequiredChecks()
108117
{
109-
return [
110-
FileExistsCheck::class,
111-
PhpLintCheck::class,
112-
CodeParseCheck::class,
113-
];
118+
return static::$requiredChecks;
114119
}
115120

116121
/**

src/ExerciseRunner/CliRunner.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ class CliRunner implements ExerciseRunnerInterface
4444
*/
4545
private $eventDispatcher;
4646

47+
/**
48+
* @var array
49+
*/
50+
private static $requiredChecks = [
51+
FileExistsCheck::class,
52+
PhpLintCheck::class,
53+
CodeParseCheck::class,
54+
];
55+
4756
/**
4857
* Requires the exercise instance and an event dispatcher.
4958
*
@@ -71,11 +80,7 @@ public function getName()
7180
*/
7281
public function getRequiredChecks()
7382
{
74-
return [
75-
FileExistsCheck::class,
76-
PhpLintCheck::class,
77-
CodeParseCheck::class,
78-
];
83+
return static::$requiredChecks;
7984
}
8085

8186
/**

0 commit comments

Comments
 (0)