mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
fix: test suite loader duplicating tests
This commit is contained in:
@ -98,14 +98,14 @@ final class TestSuiteLoader
|
|||||||
|
|
||||||
self::$loadedClasses = array_merge($loadedClasses, self::$loadedClasses);
|
self::$loadedClasses = array_merge($loadedClasses, self::$loadedClasses);
|
||||||
|
|
||||||
if (empty(self::$loadedClasses)) {
|
if (empty($loadedClasses)) {
|
||||||
return $this->exceptionFor($suiteClassName, $suiteClassFile);
|
return $this->exceptionFor($suiteClassName, $suiteClassFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
$testCaseFound = false;
|
$testCaseFound = false;
|
||||||
|
|
||||||
foreach (self::$loadedClasses as $loadedClass) {
|
foreach (array_reverse($loadedClasses) as $loadedClass) {
|
||||||
if (is_subclass_of($loadedClass, HasPrintableTestCaseName::class)) {
|
if (is_subclass_of($loadedClass, HasPrintableTestCaseName::class) || is_subclass_of($loadedClass, TestCase::class)) {
|
||||||
$suiteClassName = $loadedClass;
|
$suiteClassName = $loadedClass;
|
||||||
|
|
||||||
$testCaseFound = true;
|
$testCaseFound = true;
|
||||||
@ -115,13 +115,7 @@ final class TestSuiteLoader
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (! $testCaseFound) {
|
if (! $testCaseFound) {
|
||||||
foreach (self::$loadedClasses as $loadedClass) {
|
return $this->exceptionFor($suiteClassName, $suiteClassFile);
|
||||||
if (is_subclass_of($loadedClass, TestCase::class)) {
|
|
||||||
$suiteClassName = $loadedClass;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! class_exists($suiteClassName, false)) {
|
if (! class_exists($suiteClassName, false)) {
|
||||||
|
|||||||
@ -13,7 +13,6 @@ trait Retrievable
|
|||||||
* @template TRetrievableValue
|
* @template TRetrievableValue
|
||||||
*
|
*
|
||||||
* Safely retrieve the value at the given key from an object or array.
|
* Safely retrieve the value at the given key from an object or array.
|
||||||
*
|
|
||||||
* @template TRetrievableValue
|
* @template TRetrievableValue
|
||||||
*
|
*
|
||||||
* @param array<string, TRetrievableValue>|object $value
|
* @param array<string, TRetrievableValue>|object $value
|
||||||
|
|||||||
@ -779,6 +779,9 @@
|
|||||||
PASS Tests\PHPUnit\CustomAffixes\snakecasespec
|
PASS Tests\PHPUnit\CustomAffixes\snakecasespec
|
||||||
✓ it runs file names like `snake_case_spec.php`
|
✓ it runs file names like `snake_case_spec.php`
|
||||||
|
|
||||||
|
PASS Tests\CustomTestCase\ExecutedTest
|
||||||
|
✓ that gets executed
|
||||||
|
|
||||||
PASS Tests\PHPUnit\CustomTestCase\UsesPerDirectory
|
PASS Tests\PHPUnit\CustomTestCase\UsesPerDirectory
|
||||||
✓ closure was bound to CustomTestCase
|
✓ closure was bound to CustomTestCase
|
||||||
|
|
||||||
@ -894,4 +897,4 @@
|
|||||||
PASS Tests\Visual\Version
|
PASS Tests\Visual\Version
|
||||||
✓ visual snapshot of help command output
|
✓ visual snapshot of help command output
|
||||||
|
|
||||||
Tests: 4 incomplete, 2 todos, 18 skipped, 621 passed (1533 assertions)
|
Tests: 4 incomplete, 2 todos, 18 skipped, 622 passed (1509 assertions)
|
||||||
Reference in New Issue
Block a user