feat: pr and issue

This commit is contained in:
Nuno Maduro
2024-07-04 00:53:58 +01:00
parent 09ca7a1fd5
commit ee32f25485
26 changed files with 423 additions and 53 deletions

View File

@ -29,15 +29,29 @@ trait Testable
*/
private string $__description;
/**
* The test's latest description.
*/
private static string $__latestDescription;
/**
* The test's notes.
*/
private static array $__latestNotes = [];
/**
* The test's latest description.
* The test's issues.
*
* @var array<int, int>
*/
private static string $__latestDescription;
private static array $__latestIssues = [];
/**
* The test's PRs.
*
* @var array<int, int>
*/
private static array $__latestPrs = [];
/**
* The test's describing, if any.
@ -79,27 +93,6 @@ trait Testable
*/
private array $__snapshotChanges = [];
/**
* Adds a new "note" to the Test Case.
*/
public function note(array|string $note): self
{
$note = is_array($note) ? $note : [$note];
self::$__latestNotes = array_merge(self::$__latestNotes, $note);
return $this;
}
/**
* Resets the test case static properties.
*/
public static function flush(): void
{
self::$__beforeAll = null;
self::$__afterAll = null;
}
/**
* Creates a new Test Case instance.
*/
@ -113,11 +106,34 @@ trait Testable
$method = $test->getMethod($name);
$this->__description = self::$__latestDescription = $method->description;
self::$__latestNotes = $method->notes;
self::$__latestIssues = $method->issues;
self::$__latestPrs = $method->prs;
$this->__describing = $method->describing;
$this->__test = $method->getClosure($this);
}
}
/**
* Resets the test case static properties.
*/
public static function flush(): void
{
self::$__beforeAll = null;
self::$__afterAll = null;
}
/**
* Adds a new "note" to the Test Case.
*/
public function note(array|string $note): self
{
$note = is_array($note) ? $note : [$note];
self::$__latestNotes = array_merge(self::$__latestNotes, $note);
return $this;
}
/**
* Adds a new "setUpBeforeClass" to the Test Case.
*/
@ -243,6 +259,8 @@ trait Testable
$this->__description = self::$__latestDescription = $description;
self::$__latestNotes = $method->notes;
self::$__latestIssues = $method->issues;
self::$__latestPrs = $method->prs;
parent::setUp();
@ -432,4 +450,20 @@ trait Testable
{
return self::$__latestNotes;
}
/**
* The latest printable test case issues.
*/
public static function getPrintableTestCaseMethodIssues(): array
{
return self::$__latestIssues;
}
/**
* The latest printable test case PRs.
*/
public static function getPrintableTestCaseMethodPrs(): array
{
return self::$__latestPrs;
}
}