Adds initial implementation of --dirty option.

This commit is contained in:
Luke Downing
2022-12-05 08:59:42 +00:00
parent d77715b0fe
commit d29d68a2c2
5 changed files with 109 additions and 29 deletions

View File

@ -23,11 +23,6 @@ final class TestSuite
*/
public ?TestCase $test = null;
/**
* Holds the tests repository.
*/
public TestRepository $tests;
/**
* Holds the before each repository.
*/
@ -68,11 +63,12 @@ final class TestSuite
*/
public function __construct(
string $rootPath,
public string $testPath)
public string $testPath,
public TestRepository $tests = new TestRepository(),
)
{
$this->beforeAll = new BeforeAllRepository();
$this->beforeEach = new BeforeEachRepository();
$this->tests = new TestRepository();
$this->afterEach = new AfterEachRepository();
$this->afterAll = new AfterAllRepository();
$this->retryTempRepository = new TempRepository('retry');
@ -83,10 +79,14 @@ final class TestSuite
/**
* Returns the current instance of the test suite.
*/
public static function getInstance(string $rootPath = null, string $testPath = null): TestSuite
public static function getInstance(
string $rootPath = null,
string $testPath = null,
TestRepository $tests = null,
): TestSuite
{
if (is_string($rootPath) && is_string($testPath)) {
self::$instance = new TestSuite($rootPath, $testPath);
self::$instance = new TestSuite($rootPath, $testPath, $tests);
foreach (Plugin::$callables as $callable) {
$callable();