@@ -83,4 +83,31 @@ public function testLoadTestSuiteContainingMultipleSuitesWithSameName(): void
8383 self ::assertCount (2 , $ testSuite ->suites ['ParaTest\Tests\fixtures\github\GH997\SuccessfulTests ' ]->cases );
8484 self ::assertEquals (2 , $ testSuite ->suites ['ParaTest\Tests\fixtures\github\GH997\SuccessfulTests ' ]->tests );
8585 }
86+
87+ public function testMergeSameSuiteAcrossWorkers (): void
88+ {
89+ $ junitFiles = [
90+ new SplFileInfo (FIXTURES . '/functional_merge/worker1.xml ' ),
91+ new SplFileInfo (FIXTURES . '/functional_merge/worker2.xml ' ),
92+ ];
93+
94+ $ testSuite = (new LogMerger ())->merge ($ junitFiles );
95+ self ::assertNotNull ($ testSuite );
96+
97+ // 3 distinct class suites: ExampleTest (in both), OtherTest, AnotherTest
98+ self ::assertCount (3 , $ testSuite ->suites );
99+ self ::assertArrayHasKey ('App\Tests\ExampleTest ' , $ testSuite ->suites );
100+ self ::assertArrayHasKey ('App\Tests\OtherTest ' , $ testSuite ->suites );
101+ self ::assertArrayHasKey ('App\Tests\AnotherTest ' , $ testSuite ->suites );
102+
103+ // ExampleTest appeared in both workers — all 4 cases must be present
104+ $ exampleSuite = $ testSuite ->suites ['App\Tests\ExampleTest ' ];
105+ self ::assertSame (4 , $ exampleSuite ->tests );
106+ self ::assertSame (4 , $ exampleSuite ->assertions );
107+ self ::assertCount (4 , $ exampleSuite ->cases );
108+ self ::assertSame ('testOne ' , $ exampleSuite ->cases [0 ]->name );
109+ self ::assertSame ('testTwo ' , $ exampleSuite ->cases [1 ]->name );
110+ self ::assertSame ('testThree ' , $ exampleSuite ->cases [2 ]->name );
111+ self ::assertSame ('testFour ' , $ exampleSuite ->cases [3 ]->name );
112+ }
86113}
0 commit comments