Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

https://github.com/sebastianbergmann/phpunit/issues/5641 #5645

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Event/Value/TestSuite/TestSuiteBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public static function from(FrameworkTestSuite $testSuite): TestSuite
*/
private static function process(FrameworkTestSuite $testSuite, &$tests): void
{
foreach ($testSuite->tests() as $test) {
foreach ($testSuite->getIterator() as $test) {
if ($test instanceof FrameworkTestSuite) {
self::process($test, $tests);

Expand Down
15 changes: 15 additions & 0 deletions tests/unit/Event/Value/TestSuite/TestSuiteBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use PHPUnit\Framework\Attributes\Small;
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\TestSuite as FrameworkTestSuite;
use PHPUnit\Runner\Filter\Factory;
use PHPUnit\TextUI\CliArguments\Builder as CliArgumentsBuilder;
use PHPUnit\TextUI\Configuration\Merger as ConfigurationMerger;
use PHPUnit\TextUI\XmlConfiguration\Loader as XmlConfigurationLoader;
Expand All @@ -29,9 +30,23 @@ public function test_Builds_TestSuite_value_object_for_test_suite_loaded_from_XM
$this->assertTrue($testSuite->isWithName());
$this->assertStringEndsWith('phpunit.xml', $testSuite->name());
$this->assertSame(3, $testSuite->count());
$this->assertSame(3, $testSuite->tests()->count());
$this->assertCount(3, $testSuite->tests());
}

public function testBuildCountWithFilter(): void
{
$testSuite = $this->testSuiteFromXmlConfiguration();
$filterFactory = new Factory;
$filterFactory->addNameFilter('one');
$testSuite->injectFilter($filterFactory);
$testSuite = TestSuiteBuilder::from($testSuite);

$this->assertSame(1, $testSuite->count());
$this->assertSame(1, $testSuite->tests()->count());
$this->assertCount(1, $testSuite->tests());
}

public function test_Builds_TestSuite_value_object_for_test_case_class(): void
{
$testSuite = TestSuiteBuilder::from($this->testSuiteFromXmlConfiguration()->tests()[0]->tests()[0]);
Expand Down