From e6b13c813e07693e24da190cd06c49491a6f9e7d Mon Sep 17 00:00:00 2001 From: Filippo Tessarotto Date: Tue, 24 Feb 2026 12:48:26 +0100 Subject: [PATCH 1/3] `Makefile`: generate OTR assets --- Makefile | 23 +- test/Unit/JUnitTest.php | 4 +- test/Unit/WrapperRunner/WrapperRunnerTest.php | 2 +- .../{combined.xml => junit-combined.xml} | 0 test/fixtures/common_results/otr-combined.xml | 171 ++++ .../fixtures/common_results/otr/ErrorTest.xml | 36 + .../common_results/otr/FailureTest.xml | 36 + .../common_results/otr/IncompleteTest.xml | 35 + .../fixtures/common_results/otr/RiskyTest.xml | 30 + .../common_results/otr/SkippedTest.xml | 32 + .../common_results/otr/SuccessTest.xml | 30 + .../common_results/otr/WarningTest.xml | 30 + ...unit-data-provider-with-special-chars.xml} | 0 .../otr-data-provider-with-special-chars.xml | 819 ++++++++++++++++++ 14 files changed, 1234 insertions(+), 14 deletions(-) rename test/fixtures/common_results/{combined.xml => junit-combined.xml} (100%) create mode 100644 test/fixtures/common_results/otr-combined.xml create mode 100644 test/fixtures/common_results/otr/ErrorTest.xml create mode 100644 test/fixtures/common_results/otr/FailureTest.xml create mode 100644 test/fixtures/common_results/otr/IncompleteTest.xml create mode 100644 test/fixtures/common_results/otr/RiskyTest.xml create mode 100644 test/fixtures/common_results/otr/SkippedTest.xml create mode 100644 test/fixtures/common_results/otr/SuccessTest.xml create mode 100644 test/fixtures/common_results/otr/WarningTest.xml rename test/fixtures/special_chars/{data-provider-with-special-chars.xml => junit-data-provider-with-special-chars.xml} (100%) create mode 100644 test/fixtures/special_chars/otr-data-provider-with-special-chars.xml diff --git a/Makefile b/Makefile index ca2fdefa..fae8e789 100644 --- a/Makefile +++ b/Makefile @@ -72,19 +72,20 @@ clean: .PHONY: regenerate-fixture-results regenerate-fixture-results: vendor $(DOCKER_PHP_EXEC) vendor/bin/phpunit \ - --log-junit test/fixtures/special_chars/data-provider-with-special-chars.xml \ + --log-junit test/fixtures/special_chars/junit-data-provider-with-special-chars.xml \ + --log-otr test/fixtures/special_chars/otr-data-provider-with-special-chars.xml \ --no-configuration \ test/fixtures/special_chars/UnitTestWithDataProviderSpecialCharsTest.php \ > /dev/null || true - $(DOCKER_PHP_EXEC) vendor/bin/phpunit --no-configuration test/fixtures/common_results/ErrorTest.php --log-junit test/fixtures/common_results/junit/ErrorTest.xml > /dev/null || true - $(DOCKER_PHP_EXEC) vendor/bin/phpunit --no-configuration test/fixtures/common_results/FailureTest.php --log-junit test/fixtures/common_results/junit/FailureTest.xml > /dev/null || true - $(DOCKER_PHP_EXEC) vendor/bin/phpunit --no-configuration test/fixtures/common_results/IncompleteTest.php --log-junit test/fixtures/common_results/junit/IncompleteTest.xml > /dev/null || true - $(DOCKER_PHP_EXEC) vendor/bin/phpunit --no-configuration test/fixtures/common_results/RiskyTest.php --log-junit test/fixtures/common_results/junit/RiskyTest.xml > /dev/null || true - $(DOCKER_PHP_EXEC) vendor/bin/phpunit --no-configuration test/fixtures/common_results/SkippedTest.php --log-junit test/fixtures/common_results/junit/SkippedTest.xml > /dev/null || true - $(DOCKER_PHP_EXEC) vendor/bin/phpunit --no-configuration test/fixtures/common_results/SuccessTest.php --log-junit test/fixtures/common_results/junit/SuccessTest.xml > /dev/null || true - $(DOCKER_PHP_EXEC) vendor/bin/phpunit --no-configuration test/fixtures/common_results/WarningTest.php --log-junit test/fixtures/common_results/junit/WarningTest.xml > /dev/null || true - $(DOCKER_PHP_EXEC) vendor/bin/phpunit --no-configuration test/fixtures/common_results/ --log-junit test/fixtures/common_results/combined.xml > /dev/null || true + $(DOCKER_PHP_EXEC) vendor/bin/phpunit --no-configuration test/fixtures/common_results/ErrorTest.php --log-junit test/fixtures/common_results/junit/ErrorTest.xml --log-otr test/fixtures/common_results/otr/ErrorTest.xml > /dev/null || true + $(DOCKER_PHP_EXEC) vendor/bin/phpunit --no-configuration test/fixtures/common_results/FailureTest.php --log-junit test/fixtures/common_results/junit/FailureTest.xml --log-otr test/fixtures/common_results/otr/FailureTest.xml > /dev/null || true + $(DOCKER_PHP_EXEC) vendor/bin/phpunit --no-configuration test/fixtures/common_results/IncompleteTest.php --log-junit test/fixtures/common_results/junit/IncompleteTest.xml --log-otr test/fixtures/common_results/otr/IncompleteTest.xml > /dev/null || true + $(DOCKER_PHP_EXEC) vendor/bin/phpunit --no-configuration test/fixtures/common_results/RiskyTest.php --log-junit test/fixtures/common_results/junit/RiskyTest.xml --log-otr test/fixtures/common_results/otr/RiskyTest.xml > /dev/null || true + $(DOCKER_PHP_EXEC) vendor/bin/phpunit --no-configuration test/fixtures/common_results/SkippedTest.php --log-junit test/fixtures/common_results/junit/SkippedTest.xml --log-otr test/fixtures/common_results/otr/SkippedTest.xml > /dev/null || true + $(DOCKER_PHP_EXEC) vendor/bin/phpunit --no-configuration test/fixtures/common_results/SuccessTest.php --log-junit test/fixtures/common_results/junit/SuccessTest.xml --log-otr test/fixtures/common_results/otr/SuccessTest.xml > /dev/null || true + $(DOCKER_PHP_EXEC) vendor/bin/phpunit --no-configuration test/fixtures/common_results/WarningTest.php --log-junit test/fixtures/common_results/junit/WarningTest.xml --log-otr test/fixtures/common_results/otr/WarningTest.xml > /dev/null || true + $(DOCKER_PHP_EXEC) vendor/bin/phpunit --no-configuration test/fixtures/common_results/ --log-junit test/fixtures/common_results/junit-combined.xml --log-otr test/fixtures/common_results/otr-combined.xml > /dev/null || true find test/fixtures/ -type f -name "*.xml" -print0 | xargs -0 sed -i 's#$(PWD)#.#g' find test/fixtures/ -type f -name "*.xml" -print0 | xargs -0 sed -i 's#time="........"#time="1.234567"#g' - sed -i 's#name="./test/fixtures/common_results"#name=""#g' test/fixtures/common_results/combined.xml - sed -i 's#name="CLI Arguments"#name=""#g' test/fixtures/common_results/combined.xml + sed -i 's#name="./test/fixtures/common_results"#name=""#g' test/fixtures/common_results/junit-combined.xml + sed -i 's#name="CLI Arguments"#name=""#g' test/fixtures/common_results/junit-combined.xml diff --git a/test/Unit/JUnitTest.php b/test/Unit/JUnitTest.php index 2bfcb43b..a48cd7da 100644 --- a/test/Unit/JUnitTest.php +++ b/test/Unit/JUnitTest.php @@ -53,14 +53,14 @@ public function testMergeJunitLogs(): void $xml = str_replace('time="8.641969"', 'time="1.234567"', $xml); file_put_contents($outputFile, $xml); - self::assertXmlFileEqualsXmlFile(FIXTURES . '/common_results/combined.xml', $outputFile); + self::assertXmlFileEqualsXmlFile(FIXTURES . '/common_results/junit-combined.xml', $outputFile); } public function testHandleSpecialChars(): void { $tmpDir = (new TmpDirCreator())->create(); - $junitLog = FIXTURES . '/special_chars/data-provider-with-special-chars.xml'; + $junitLog = FIXTURES . '/special_chars/junit-data-provider-with-special-chars.xml'; $testSuite = (new LogMerger())->merge([new SplFileInfo($junitLog)]); self::assertNotNull($testSuite); diff --git a/test/Unit/WrapperRunner/WrapperRunnerTest.php b/test/Unit/WrapperRunner/WrapperRunnerTest.php index aec946b9..df6651f4 100644 --- a/test/Unit/WrapperRunner/WrapperRunnerTest.php +++ b/test/Unit/WrapperRunner/WrapperRunnerTest.php @@ -542,7 +542,7 @@ public function testWritesLogWithEmptyNameWhenPathIsNotProvided(): void $xml = preg_replace('/time="[^"]+"/', 'time="1.234567"', $xml); file_put_contents($outputFile, $xml); - self::assertXmlFileEqualsXmlFile(FIXTURES . '/common_results/combined.xml', $outputFile); + self::assertXmlFileEqualsXmlFile(FIXTURES . '/common_results/junit-combined.xml', $outputFile); } public function testRunnerReversed(): void diff --git a/test/fixtures/common_results/combined.xml b/test/fixtures/common_results/junit-combined.xml similarity index 100% rename from test/fixtures/common_results/combined.xml rename to test/fixtures/common_results/junit-combined.xml diff --git a/test/fixtures/common_results/otr-combined.xml b/test/fixtures/common_results/otr-combined.xml new file mode 100644 index 00000000..baf0e16e --- /dev/null +++ b/test/fixtures/common_results/otr-combined.xml @@ -0,0 +1,171 @@ + + + + a04e43d8b907 + code + Linux a04e43d8b907 6.17.0-14-generic #14~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jan 15 15:52:10 UTC 2 x86_64 + 8.3.30 + NTS + + + + + + + + + + + + + + + + + + + + + Error here! + + + + + + + + + + + + + + + + + + + + + + + Failed asserting that false is true. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/fixtures/common_results/otr/ErrorTest.xml b/test/fixtures/common_results/otr/ErrorTest.xml new file mode 100644 index 00000000..f4fcf277 --- /dev/null +++ b/test/fixtures/common_results/otr/ErrorTest.xml @@ -0,0 +1,36 @@ + + + + 4f26eb8a2250 + code + Linux 4f26eb8a2250 6.17.0-14-generic #14~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jan 15 15:52:10 UTC 2 x86_64 + 8.3.30 + NTS + + + + + + + + + + + + + + + + + + + + Error here! + + + + + diff --git a/test/fixtures/common_results/otr/FailureTest.xml b/test/fixtures/common_results/otr/FailureTest.xml new file mode 100644 index 00000000..939b61c5 --- /dev/null +++ b/test/fixtures/common_results/otr/FailureTest.xml @@ -0,0 +1,36 @@ + + + + 2a2ca7d0750d + code + Linux 2a2ca7d0750d 6.17.0-14-generic #14~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jan 15 15:52:10 UTC 2 x86_64 + 8.3.30 + NTS + + + + + + + + + + + + + + + + + + + + Failed asserting that false is true. + + + + + diff --git a/test/fixtures/common_results/otr/IncompleteTest.xml b/test/fixtures/common_results/otr/IncompleteTest.xml new file mode 100644 index 00000000..a63ca679 --- /dev/null +++ b/test/fixtures/common_results/otr/IncompleteTest.xml @@ -0,0 +1,35 @@ + + + + c04355cc6b2f + code + Linux c04355cc6b2f 6.17.0-14-generic #14~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jan 15 15:52:10 UTC 2 x86_64 + 8.3.30 + NTS + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/fixtures/common_results/otr/RiskyTest.xml b/test/fixtures/common_results/otr/RiskyTest.xml new file mode 100644 index 00000000..0b6a4910 --- /dev/null +++ b/test/fixtures/common_results/otr/RiskyTest.xml @@ -0,0 +1,30 @@ + + + + 9ac2e0bc7371 + code + Linux 9ac2e0bc7371 6.17.0-14-generic #14~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jan 15 15:52:10 UTC 2 x86_64 + 8.3.30 + NTS + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/fixtures/common_results/otr/SkippedTest.xml b/test/fixtures/common_results/otr/SkippedTest.xml new file mode 100644 index 00000000..624ca565 --- /dev/null +++ b/test/fixtures/common_results/otr/SkippedTest.xml @@ -0,0 +1,32 @@ + + + + bf9ca64a960d + code + Linux bf9ca64a960d 6.17.0-14-generic #14~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jan 15 15:52:10 UTC 2 x86_64 + 8.3.30 + NTS + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/fixtures/common_results/otr/SuccessTest.xml b/test/fixtures/common_results/otr/SuccessTest.xml new file mode 100644 index 00000000..3ecdabcf --- /dev/null +++ b/test/fixtures/common_results/otr/SuccessTest.xml @@ -0,0 +1,30 @@ + + + + 3116ebc52d14 + code + Linux 3116ebc52d14 6.17.0-14-generic #14~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jan 15 15:52:10 UTC 2 x86_64 + 8.3.30 + NTS + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/fixtures/common_results/otr/WarningTest.xml b/test/fixtures/common_results/otr/WarningTest.xml new file mode 100644 index 00000000..711d08dc --- /dev/null +++ b/test/fixtures/common_results/otr/WarningTest.xml @@ -0,0 +1,30 @@ + + + + cc3301deb051 + code + Linux cc3301deb051 6.17.0-14-generic #14~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jan 15 15:52:10 UTC 2 x86_64 + 8.3.30 + NTS + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/fixtures/special_chars/data-provider-with-special-chars.xml b/test/fixtures/special_chars/junit-data-provider-with-special-chars.xml similarity index 100% rename from test/fixtures/special_chars/data-provider-with-special-chars.xml rename to test/fixtures/special_chars/junit-data-provider-with-special-chars.xml diff --git a/test/fixtures/special_chars/otr-data-provider-with-special-chars.xml b/test/fixtures/special_chars/otr-data-provider-with-special-chars.xml new file mode 100644 index 00000000..78060956 --- /dev/null +++ b/test/fixtures/special_chars/otr-data-provider-with-special-chars.xml @@ -0,0 +1,819 @@ + + + + bd7ab86dcf4b + code + Linux bd7ab86dcf4b 6.17.0-14-generic #14~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jan 15 15:52:10 UTC 2 x86_64 + 8.3.30 + NTS + + + + + + + + + + + + + + + + + + + + + 0 +Failed asserting that '' is false. + + + + + + + + + + + + + + 65 +Failed asserting that 'A' is false. + + + + + + + + + + + + + + 92 +Failed asserting that '\' is false. + + + + + + + + + + + + + + 124 +Failed asserting that '|' is false. + + + + + + + + + + + + + + 33 +Failed asserting that '!' is false. + + + + + + + + + + + + + + 34 +Failed asserting that '"' is false. + + + + + + + + + + + + + + 194 +Failed asserting that '£' is false. + + + + + + + + + + + + + + 36 +Failed asserting that '$' is false. + + + + + + + + + + + + + + 37 +Failed asserting that '%' is false. + + + + + + + + + + + + + + 38 +Failed asserting that '&' is false. + + + + + + + + + + + + + + 40 +Failed asserting that '(' is false. + + + + + + + + + + + + + + 41 +Failed asserting that ')' is false. + + + + + + + + + + + + + + 61 +Failed asserting that '=' is false. + + + + + + + + + + + + + + 63 +Failed asserting that '?' is false. + + + + + + + + + + + + + + 195 +Failed asserting that 'à' is false. + + + + + + + + + + + + + + 195 +Failed asserting that 'è' is false. + + + + + + + + + + + + + + 195 +Failed asserting that 'ì' is false. + + + + + + + + + + + + + + 195 +Failed asserting that 'ò' is false. + + + + + + + + + + + + + + 195 +Failed asserting that 'ù' is false. + + + + + + + + + + + + + + 195 +Failed asserting that 'À' is false. + + + + + + + + + + + + + + 195 +Failed asserting that 'È' is false. + + + + + + + + + + + + + + 195 +Failed asserting that 'Ì' is false. + + + + + + + + + + + + + + 195 +Failed asserting that 'Ò' is false. + + + + + + + + + + + + + + 195 +Failed asserting that 'Ù' is false. + + + + + + + + + + + + + + 60 +Failed asserting that '<' is false. + + + + + + + + + + + + + + 62 +Failed asserting that '>' is false. + ' is false. + +./test/fixtures/special_chars/UnitTestWithDataProviderSpecialCharsTest.php:19 +]]> + + + + + + + + + + + + + 45 +Failed asserting that '-' is false. + + + + + + + + + + + + + + 95 +Failed asserting that '_' is false. + + + + + + + + + + + + + + 64 +Failed asserting that '@' is false. + + + + + + + + + + + + + + 35 +Failed asserting that '#' is false. + + + + + + + + + + + + + + 91 +Failed asserting that '[' is false. + + + + + + + + + + + + + + 93 +Failed asserting that ']' is false. + + + + + + + + + + + + + + 195 +Failed asserting that 'ß' is false. + + + + + + + + + + + + + + 208 +Failed asserting that 'б' is false. + + + + + + + + + + + + + + 207 +Failed asserting that 'π' is false. + + + + + + + + + + + + + + 226 +Failed asserting that '€' is false. + + + + + + + + + + + + + + 226 +Failed asserting that '✔' is false. + + + + + + + + + + + + + + 228 +Failed asserting that '你' is false. + + + + + + + + + + + + + + 217 +Failed asserting that 'ي' is false. + + + + + + + + + + + + + + 216 +Failed asserting that 'د' is false. + + + + + + + + + + + + + + 90 +Failed asserting that 'Z' is false. + + + + + + + + + + + + + + 0 +Failed asserting that '' is false. + + + + + + From e986e73f750828ef39b6d078348ec66b7779f1c0 Mon Sep 17 00:00:00 2001 From: Filippo Tessarotto Date: Tue, 24 Feb 2026 14:23:40 +0100 Subject: [PATCH 2/3] Standard times --- Makefile | 5 +- test/fixtures/common_results/otr-combined.xml | 64 +++---- .../fixtures/common_results/otr/ErrorTest.xml | 12 +- .../common_results/otr/FailureTest.xml | 12 +- .../common_results/otr/IncompleteTest.xml | 12 +- .../fixtures/common_results/otr/RiskyTest.xml | 12 +- .../common_results/otr/SkippedTest.xml | 12 +- .../common_results/otr/SuccessTest.xml | 12 +- .../common_results/otr/WarningTest.xml | 12 +- .../otr-data-provider-with-special-chars.xml | 180 +++++++++--------- 10 files changed, 167 insertions(+), 166 deletions(-) diff --git a/Makefile b/Makefile index fae8e789..3efcffd5 100644 --- a/Makefile +++ b/Makefile @@ -87,5 +87,6 @@ regenerate-fixture-results: vendor $(DOCKER_PHP_EXEC) vendor/bin/phpunit --no-configuration test/fixtures/common_results/ --log-junit test/fixtures/common_results/junit-combined.xml --log-otr test/fixtures/common_results/otr-combined.xml > /dev/null || true find test/fixtures/ -type f -name "*.xml" -print0 | xargs -0 sed -i 's#$(PWD)#.#g' find test/fixtures/ -type f -name "*.xml" -print0 | xargs -0 sed -i 's#time="........"#time="1.234567"#g' - sed -i 's#name="./test/fixtures/common_results"#name=""#g' test/fixtures/common_results/junit-combined.xml - sed -i 's#name="CLI Arguments"#name=""#g' test/fixtures/common_results/junit-combined.xml + find test/fixtures/ -type f -name "*.xml" -print0 | xargs -0 sed -i 's#time="..........................."#time="2026-02-01T12:13:14.567890Z"#g' + sed -i 's#name="./test/fixtures/common_results"#name=""#g' test/fixtures/common_results/junit-combined.xml test/fixtures/common_results/otr-combined.xml + sed -i 's#name="CLI Arguments"#name=""#g' test/fixtures/common_results/junit-combined.xml test/fixtures/common_results/otr-combined.xml diff --git a/test/fixtures/common_results/otr-combined.xml b/test/fixtures/common_results/otr-combined.xml index baf0e16e..d0e3e4c3 100644 --- a/test/fixtures/common_results/otr-combined.xml +++ b/test/fixtures/common_results/otr-combined.xml @@ -1,14 +1,14 @@ - a04e43d8b907 + 398c61687e1b code - Linux a04e43d8b907 6.17.0-14-generic #14~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jan 15 15:52:10 UTC 2 x86_64 + Linux 398c61687e1b 6.17.0-14-generic #14~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jan 15 15:52:10 UTC 2 x86_64 8.3.30 NTS - - + + @@ -16,7 +16,7 @@ - + @@ -24,7 +24,7 @@ - + Error here! - - + + @@ -42,7 +42,7 @@ - + @@ -50,7 +50,7 @@ - + Failed asserting that false is true. - - + + @@ -68,7 +68,7 @@ - + @@ -76,7 +76,7 @@ - + - - + + @@ -93,7 +93,7 @@ - + @@ -101,11 +101,11 @@ - + - - + + @@ -113,7 +113,7 @@ - + @@ -121,13 +121,13 @@ - + - - + + @@ -135,7 +135,7 @@ - + @@ -143,11 +143,11 @@ - + - - + + @@ -155,7 +155,7 @@ - + @@ -163,9 +163,9 @@ - + - - + + diff --git a/test/fixtures/common_results/otr/ErrorTest.xml b/test/fixtures/common_results/otr/ErrorTest.xml index f4fcf277..d8b53bcd 100644 --- a/test/fixtures/common_results/otr/ErrorTest.xml +++ b/test/fixtures/common_results/otr/ErrorTest.xml @@ -1,13 +1,13 @@ - 4f26eb8a2250 + 931720dd8f74 code - Linux 4f26eb8a2250 6.17.0-14-generic #14~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jan 15 15:52:10 UTC 2 x86_64 + Linux 931720dd8f74 6.17.0-14-generic #14~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jan 15 15:52:10 UTC 2 x86_64 8.3.30 NTS - + @@ -15,7 +15,7 @@ - + @@ -23,7 +23,7 @@ - + Error here! - + diff --git a/test/fixtures/common_results/otr/FailureTest.xml b/test/fixtures/common_results/otr/FailureTest.xml index 939b61c5..425f1e0f 100644 --- a/test/fixtures/common_results/otr/FailureTest.xml +++ b/test/fixtures/common_results/otr/FailureTest.xml @@ -1,13 +1,13 @@ - 2a2ca7d0750d + fdf0a93f2d54 code - Linux 2a2ca7d0750d 6.17.0-14-generic #14~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jan 15 15:52:10 UTC 2 x86_64 + Linux fdf0a93f2d54 6.17.0-14-generic #14~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jan 15 15:52:10 UTC 2 x86_64 8.3.30 NTS - + @@ -15,7 +15,7 @@ - + @@ -23,7 +23,7 @@ - + Failed asserting that false is true. - + diff --git a/test/fixtures/common_results/otr/IncompleteTest.xml b/test/fixtures/common_results/otr/IncompleteTest.xml index a63ca679..47ef219d 100644 --- a/test/fixtures/common_results/otr/IncompleteTest.xml +++ b/test/fixtures/common_results/otr/IncompleteTest.xml @@ -1,13 +1,13 @@ - c04355cc6b2f + 9abde680f765 code - Linux c04355cc6b2f 6.17.0-14-generic #14~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jan 15 15:52:10 UTC 2 x86_64 + Linux 9abde680f765 6.17.0-14-generic #14~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jan 15 15:52:10 UTC 2 x86_64 8.3.30 NTS - + @@ -15,7 +15,7 @@ - + @@ -23,7 +23,7 @@ - + - + diff --git a/test/fixtures/common_results/otr/RiskyTest.xml b/test/fixtures/common_results/otr/RiskyTest.xml index 0b6a4910..4f5d532d 100644 --- a/test/fixtures/common_results/otr/RiskyTest.xml +++ b/test/fixtures/common_results/otr/RiskyTest.xml @@ -1,13 +1,13 @@ - 9ac2e0bc7371 + bf97c0526199 code - Linux 9ac2e0bc7371 6.17.0-14-generic #14~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jan 15 15:52:10 UTC 2 x86_64 + Linux bf97c0526199 6.17.0-14-generic #14~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jan 15 15:52:10 UTC 2 x86_64 8.3.30 NTS - + @@ -15,7 +15,7 @@ - + @@ -23,8 +23,8 @@ - + - + diff --git a/test/fixtures/common_results/otr/SkippedTest.xml b/test/fixtures/common_results/otr/SkippedTest.xml index 624ca565..ebba32bf 100644 --- a/test/fixtures/common_results/otr/SkippedTest.xml +++ b/test/fixtures/common_results/otr/SkippedTest.xml @@ -1,13 +1,13 @@ - bf9ca64a960d + 25e66a83083a code - Linux bf9ca64a960d 6.17.0-14-generic #14~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jan 15 15:52:10 UTC 2 x86_64 + Linux 25e66a83083a 6.17.0-14-generic #14~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jan 15 15:52:10 UTC 2 x86_64 8.3.30 NTS - + @@ -15,7 +15,7 @@ - + @@ -23,10 +23,10 @@ - + - + diff --git a/test/fixtures/common_results/otr/SuccessTest.xml b/test/fixtures/common_results/otr/SuccessTest.xml index 3ecdabcf..e08d9efd 100644 --- a/test/fixtures/common_results/otr/SuccessTest.xml +++ b/test/fixtures/common_results/otr/SuccessTest.xml @@ -1,13 +1,13 @@ - 3116ebc52d14 + 4a750c3af83d code - Linux 3116ebc52d14 6.17.0-14-generic #14~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jan 15 15:52:10 UTC 2 x86_64 + Linux 4a750c3af83d 6.17.0-14-generic #14~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jan 15 15:52:10 UTC 2 x86_64 8.3.30 NTS - + @@ -15,7 +15,7 @@ - + @@ -23,8 +23,8 @@ - + - + diff --git a/test/fixtures/common_results/otr/WarningTest.xml b/test/fixtures/common_results/otr/WarningTest.xml index 711d08dc..6d2916eb 100644 --- a/test/fixtures/common_results/otr/WarningTest.xml +++ b/test/fixtures/common_results/otr/WarningTest.xml @@ -1,13 +1,13 @@ - cc3301deb051 + ec5e72506720 code - Linux cc3301deb051 6.17.0-14-generic #14~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jan 15 15:52:10 UTC 2 x86_64 + Linux ec5e72506720 6.17.0-14-generic #14~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jan 15 15:52:10 UTC 2 x86_64 8.3.30 NTS - + @@ -15,7 +15,7 @@ - + @@ -23,8 +23,8 @@ - + - + diff --git a/test/fixtures/special_chars/otr-data-provider-with-special-chars.xml b/test/fixtures/special_chars/otr-data-provider-with-special-chars.xml index 78060956..59e24f9c 100644 --- a/test/fixtures/special_chars/otr-data-provider-with-special-chars.xml +++ b/test/fixtures/special_chars/otr-data-provider-with-special-chars.xml @@ -1,13 +1,13 @@ - bd7ab86dcf4b + 5cd4b06b41d1 code - Linux bd7ab86dcf4b 6.17.0-14-generic #14~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jan 15 15:52:10 UTC 2 x86_64 + Linux 5cd4b06b41d1 6.17.0-14-generic #14~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jan 15 15:52:10 UTC 2 x86_64 8.3.30 NTS - + @@ -15,8 +15,8 @@ - - + + @@ -24,7 +24,7 @@ - + 0 Failed asserting that '' is false. @@ -35,7 +35,7 @@ Failed asserting that '' is false. ]]> - + @@ -43,7 +43,7 @@ Failed asserting that '' is false. - + 65 Failed asserting that 'A' is false. @@ -54,7 +54,7 @@ Failed asserting that 'A' is false. ]]> - + @@ -62,7 +62,7 @@ Failed asserting that 'A' is false. - + 92 Failed asserting that '\' is false. @@ -73,7 +73,7 @@ Failed asserting that '\' is false. ]]> - + @@ -81,7 +81,7 @@ Failed asserting that '\' is false. - + 124 Failed asserting that '|' is false. @@ -92,7 +92,7 @@ Failed asserting that '|' is false. ]]> - + @@ -100,7 +100,7 @@ Failed asserting that '|' is false. - + 33 Failed asserting that '!' is false. @@ -111,7 +111,7 @@ Failed asserting that '!' is false. ]]> - + @@ -119,7 +119,7 @@ Failed asserting that '!' is false. - + 34 Failed asserting that '"' is false. @@ -130,7 +130,7 @@ Failed asserting that '"' is false. ]]> - + @@ -138,7 +138,7 @@ Failed asserting that '"' is false. - + 194 Failed asserting that '£' is false. @@ -149,7 +149,7 @@ Failed asserting that '£' is false. ]]> - + @@ -157,7 +157,7 @@ Failed asserting that '£' is false. - + 36 Failed asserting that '$' is false. @@ -168,7 +168,7 @@ Failed asserting that '$' is false. ]]> - + @@ -176,7 +176,7 @@ Failed asserting that '$' is false. - + 37 Failed asserting that '%' is false. @@ -187,7 +187,7 @@ Failed asserting that '%' is false. ]]> - + @@ -195,7 +195,7 @@ Failed asserting that '%' is false. - + 38 Failed asserting that '&' is false. @@ -206,7 +206,7 @@ Failed asserting that '&' is false. ]]> - + @@ -214,7 +214,7 @@ Failed asserting that '&' is false. - + 40 Failed asserting that '(' is false. @@ -225,7 +225,7 @@ Failed asserting that '(' is false. ]]> - + @@ -233,7 +233,7 @@ Failed asserting that '(' is false. - + 41 Failed asserting that ')' is false. @@ -244,7 +244,7 @@ Failed asserting that ')' is false. ]]> - + @@ -252,7 +252,7 @@ Failed asserting that ')' is false. - + 61 Failed asserting that '=' is false. @@ -263,7 +263,7 @@ Failed asserting that '=' is false. ]]> - + @@ -271,7 +271,7 @@ Failed asserting that '=' is false. - + 63 Failed asserting that '?' is false. @@ -282,7 +282,7 @@ Failed asserting that '?' is false. ]]> - + @@ -290,7 +290,7 @@ Failed asserting that '?' is false. - + 195 Failed asserting that 'à' is false. @@ -301,7 +301,7 @@ Failed asserting that 'à' is false. ]]> - + @@ -309,7 +309,7 @@ Failed asserting that 'à' is false. - + 195 Failed asserting that 'è' is false. @@ -320,7 +320,7 @@ Failed asserting that 'è' is false. ]]> - + @@ -328,7 +328,7 @@ Failed asserting that 'è' is false. - + 195 Failed asserting that 'ì' is false. @@ -339,7 +339,7 @@ Failed asserting that 'ì' is false. ]]> - + @@ -347,7 +347,7 @@ Failed asserting that 'ì' is false. - + 195 Failed asserting that 'ò' is false. @@ -358,7 +358,7 @@ Failed asserting that 'ò' is false. ]]> - + @@ -366,7 +366,7 @@ Failed asserting that 'ò' is false. - + 195 Failed asserting that 'ù' is false. @@ -377,7 +377,7 @@ Failed asserting that 'ù' is false. ]]> - + @@ -385,7 +385,7 @@ Failed asserting that 'ù' is false. - + 195 Failed asserting that 'À' is false. @@ -396,7 +396,7 @@ Failed asserting that 'À' is false. ]]> - + @@ -404,7 +404,7 @@ Failed asserting that 'À' is false. - + 195 Failed asserting that 'È' is false. @@ -415,7 +415,7 @@ Failed asserting that 'È' is false. ]]> - + @@ -423,7 +423,7 @@ Failed asserting that 'È' is false. - + 195 Failed asserting that 'Ì' is false. @@ -434,7 +434,7 @@ Failed asserting that 'Ì' is false. ]]> - + @@ -442,7 +442,7 @@ Failed asserting that 'Ì' is false. - + 195 Failed asserting that 'Ò' is false. @@ -453,7 +453,7 @@ Failed asserting that 'Ò' is false. ]]> - + @@ -461,7 +461,7 @@ Failed asserting that 'Ò' is false. - + 195 Failed asserting that 'Ù' is false. @@ -472,7 +472,7 @@ Failed asserting that 'Ù' is false. ]]> - + @@ -480,7 +480,7 @@ Failed asserting that 'Ù' is false. - + 60 Failed asserting that '<' is false. @@ -491,7 +491,7 @@ Failed asserting that '<' is false. ]]> - + @@ -499,7 +499,7 @@ Failed asserting that '<' is false. - + 62 Failed asserting that '>' is false. @@ -510,7 +510,7 @@ Failed asserting that '>' is false. ]]> - + @@ -518,7 +518,7 @@ Failed asserting that '>' is false. - + 45 Failed asserting that '-' is false. @@ -529,7 +529,7 @@ Failed asserting that '-' is false. ]]> - + @@ -537,7 +537,7 @@ Failed asserting that '-' is false. - + 95 Failed asserting that '_' is false. @@ -548,7 +548,7 @@ Failed asserting that '_' is false. ]]> - + @@ -556,7 +556,7 @@ Failed asserting that '_' is false. - + 64 Failed asserting that '@' is false. @@ -567,7 +567,7 @@ Failed asserting that '@' is false. ]]> - + @@ -575,7 +575,7 @@ Failed asserting that '@' is false. - + 35 Failed asserting that '#' is false. @@ -586,7 +586,7 @@ Failed asserting that '#' is false. ]]> - + @@ -594,7 +594,7 @@ Failed asserting that '#' is false. - + 91 Failed asserting that '[' is false. @@ -605,7 +605,7 @@ Failed asserting that '[' is false. ]]> - + @@ -613,7 +613,7 @@ Failed asserting that '[' is false. - + 93 Failed asserting that ']' is false. @@ -624,7 +624,7 @@ Failed asserting that ']' is false. ]]> - + @@ -632,7 +632,7 @@ Failed asserting that ']' is false. - + 195 Failed asserting that 'ß' is false. @@ -643,7 +643,7 @@ Failed asserting that 'ß' is false. ]]> - + @@ -651,7 +651,7 @@ Failed asserting that 'ß' is false. - + 208 Failed asserting that 'б' is false. @@ -662,7 +662,7 @@ Failed asserting that 'б' is false. ]]> - + @@ -670,7 +670,7 @@ Failed asserting that 'б' is false. - + 207 Failed asserting that 'π' is false. @@ -681,7 +681,7 @@ Failed asserting that 'π' is false. ]]> - + @@ -689,7 +689,7 @@ Failed asserting that 'π' is false. - + 226 Failed asserting that '€' is false. @@ -700,7 +700,7 @@ Failed asserting that '€' is false. ]]> - + @@ -708,7 +708,7 @@ Failed asserting that '€' is false. - + 226 Failed asserting that '✔' is false. @@ -719,7 +719,7 @@ Failed asserting that '✔' is false. ]]> - + @@ -727,7 +727,7 @@ Failed asserting that '✔' is false. - + 228 Failed asserting that '你' is false. @@ -738,7 +738,7 @@ Failed asserting that '你' is false. ]]> - + @@ -746,7 +746,7 @@ Failed asserting that '你' is false. - + 217 Failed asserting that 'ي' is false. @@ -757,7 +757,7 @@ Failed asserting that 'ي' is false. ]]> - + @@ -765,7 +765,7 @@ Failed asserting that 'ي' is false. - + 216 Failed asserting that 'د' is false. @@ -776,7 +776,7 @@ Failed asserting that 'د' is false. ]]> - + @@ -784,7 +784,7 @@ Failed asserting that 'د' is false. - + 90 Failed asserting that 'Z' is false. @@ -795,7 +795,7 @@ Failed asserting that 'Z' is false. ]]> - + @@ -803,7 +803,7 @@ Failed asserting that 'Z' is false. - + 0 Failed asserting that '' is false. @@ -814,6 +814,6 @@ Failed asserting that '' is false. ]]> - - + + From b46fd37454c679531f462d7041ba243132d99659 Mon Sep 17 00:00:00 2001 From: Filippo Tessarotto Date: Wed, 25 Feb 2026 15:14:54 +0100 Subject: [PATCH 3/3] Continue --- src/Otr/Event.php | 8 +++++ src/Otr/Events.php | 28 ++++++++++++++++++ src/Otr/LogMerger.php | 68 +++++++++++++++++++++++++++++++++++++++++++ test/Unit/OtrTest.php | 50 +++++++++++++++++++++++++++++++ 4 files changed, 154 insertions(+) create mode 100644 src/Otr/Event.php create mode 100644 src/Otr/Events.php create mode 100644 src/Otr/LogMerger.php create mode 100644 test/Unit/OtrTest.php diff --git a/src/Otr/Event.php b/src/Otr/Event.php new file mode 100644 index 00000000..6622f196 --- /dev/null +++ b/src/Otr/Event.php @@ -0,0 +1,8 @@ +isFile() && 0 < (int) $logFile->getSize()); + + $logFileContents = file_get_contents($logFile->getPathname()); + assert($logFileContents !== false); +$xml = new SimpleXMLElement($logFileContents); +var_dump($xml->children('e', true)); +foreach ($xml->children('e', true) as $event) { + var_dump($event);exit(); +} +var_dump('end');exit; +print_r($xml);exit; + return self::parseTestSuite( + new SimpleXMLElement($logFileContents), + true, + ); + } +} \ No newline at end of file diff --git a/src/Otr/LogMerger.php b/src/Otr/LogMerger.php new file mode 100644 index 00000000..88fbb51b --- /dev/null +++ b/src/Otr/LogMerger.php @@ -0,0 +1,68 @@ + $otrFiles */ + public function merge(array $otrFiles) + { + $mainSuite = null; + foreach ($otrFiles as $otrFile) { + if (! $otrFile->isFile()) { + continue; + } + + $otherSuite = Events::fromFile($otrFile); + if ($mainSuite === null) { + $mainSuite = $otherSuite; + continue; + } + + if ($mainSuite->name !== $otherSuite->name) { + if ($mainSuite->name !== '') { + $mainSuite = new TestSuite( + '', + $mainSuite->tests, + $mainSuite->assertions, + $mainSuite->failures, + $mainSuite->errors, + $mainSuite->skipped, + $mainSuite->time, + '', + [$mainSuite->name => $mainSuite], + [], + ); + } + + if ($otherSuite->name !== '') { + $otherSuite = new TestSuite( + '', + $otherSuite->tests, + $otherSuite->assertions, + $otherSuite->failures, + $otherSuite->errors, + $otherSuite->skipped, + $otherSuite->time, + '', + [$otherSuite->name => $otherSuite], + [], + ); + } + } + + $mainSuite = $mainSuite->mergeWith($otherSuite); + } + + return $mainSuite; + } +} diff --git a/test/Unit/OtrTest.php b/test/Unit/OtrTest.php new file mode 100644 index 00000000..a8678928 --- /dev/null +++ b/test/Unit/OtrTest.php @@ -0,0 +1,50 @@ +create(); + + $otrFiles = []; + $glob = glob(FIXTURES . '/common_results/otr/*'); + self::assertNotFalse($glob); + foreach ($glob as $file) { + $otrFiles[] = new SplFileInfo($file); + } + + self::assertNotSame([], $otrFiles); + $testSuite = (new LogMerger())->merge($otrFiles); + self::assertNotNull($testSuite); + + $outputFile = $tmpDir . '/result.xml'; + (new Writer())->write( + $testSuite, + $outputFile, + ); + + $xml = file_get_contents($outputFile); + self::assertNotFalse($xml); + file_put_contents($outputFile, $xml); + + self::assertXmlFileEqualsXmlFile(FIXTURES . '/common_results/otr-combined.xml', $outputFile); + } +}