Skip to content

Commit

Permalink
Merge branch '10.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Jan 7, 2024
2 parents 67a7e65 + 3ed35d9 commit a683689
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Event/Value/TestSuite/TestSuiteBuilder.php
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
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->addIncludeNameFilter('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

0 comments on commit a683689

Please sign in to comment.