You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Model RepeatTestSuite as a TestSuite, mirroring DataProviderTestSuite
Previously, RepeatTestSuite was declared as a leaf Test even though it structurally represents a group of test cases (the N repetitions of a test method). This produced two inconsistencies:
* TestSuite::addTest() registered the suite under the first repetition's id (Class::method (repetition 1 of N)) rather than the group id, so other repetitions appeared as no members of the group.
* Event\TestSuite\TestSuiteBuilder::process() treated the suite as a leaf and surfaced only tests[0]->valueObjectForEvents() into the parent's TestCollection. The collection therefore had one entry per repetition group while count() reported N: the two disagreed.
Both issues are removed by treating RepeatTestSuite the same way DataProviderTestSuite is treated:
* RepeatTestSuite now extends Framework\TestSuite and is constructed via RepeatTestSuite::fromTests($name, $tests, $failureThreshold). It overrides run() to retain the failure-threshold/abort semantics and delegates provides(), requires(), sortId(), and setDependencies() to its first child / all children.
* A dedicated event-level value object TestSuiteForRepeatedTestMethod is introduced alongside TestSuiteForTestMethodWithDataProvider. It exposes className(), methodName(), file(), line(), and an isForRepeatedTestMethod() predicate on the base Event\TestSuite\TestSuite.
* Event\TestSuite\TestSuiteBuilder::from() detects RepeatTestSuite and returns the new value object; process() recurses through it like any other framework TestSuite, so each repetition's TestMethod event value object now appears in the parent's TestCollection.
* The special-case branches in Framework\TestSuite::addTest() and Runner\Filter\NameFilterIterator::accept() are removed. The inherited instanceof self branch handles registration; the existing TestSuite branch in the filter recurses into children, which then match individually.
* Runner\TestResult\Collector::testSuiteFinished() learns about the new value object and, when no repetition of the method failed, records the method as passed via PassedTests::testMethodPassed(), mirroring the data-provider handler.
As a consequence of RepeatTestSuite being a real TestSuite, Test Suite Started / Test Suite Finished events are now emitted around each repetition group. The JUnit XML logger correspondingly produces a nested <testsuite> element per repeated method, matching how it already renders data-provider suites.
0 commit comments