1
0
Fork 0
mirror of https://github.com/dorny/test-reporter.git synced 2026-03-22 07:52:14 +01:00
test-reporter/__tests__/__outputs__/phpunit-test-results.md
YuF-9468 f0016cb1da fix: Extract error message from PHPUnit error details when message attribute is missing
Fixes #711

When PHPUnit XML output contains <error> or <failure> elements without a
message attribute, the parser now extracts the error message from the error
details text instead of only showing the error type.

The improved logic:
1. Prefer message attribute when present (with type prepended)
2. Extract error message from details when it contains a line matching
   the error type (e.g., "TypeError: ...")
3. Fall back to first line of details
4. Finally, use error type as last resort

This provides more informative error messages in test reports when
PHPUnit outputs errors with the full stack trace in the element text
rather than a message attribute.
2026-03-16 21:39:44 +08:00

2 KiB

Tests failed

Report Passed Failed Skipped Time
fixtures/phpunit/phpunit.xml 10 2 148ms

 fixtures/phpunit/phpunit.xml

12 tests were completed in 148ms with 10 passed, 2 failed and 0 skipped.

Test suite Passed Failed Skipped Time
CLI Arguments 2 140ms
PHPUnit\Event\CollectingDispatcherTest 2 4ms
PHPUnit\Event\DeferringDispatcherTest 4 3ms
PHPUnit\Event\DirectDispatcherTest 4 1ms

 CLI Arguments

❌ targeting-traits-with-coversclass-attribute-is-deprecated.phpt
	targeting-traits-with-coversclass-attribute-is-deprecated.phptFailed asserting that string matches format description.
❌ targeting-traits-with-usesclass-attribute-is-deprecated.phpt
	targeting-traits-with-usesclass-attribute-is-deprecated.phptFailed asserting that string matches format description.

 PHPUnit\Event\CollectingDispatcherTest

PHPUnit.Event.CollectingDispatcherTest
  ✅ testHasNoCollectedEventsWhenFlushedImmediatelyAfterCreation
  ✅ testCollectsDispatchedEventsUntilFlushed

 PHPUnit\Event\DeferringDispatcherTest

PHPUnit.Event.DeferringDispatcherTest
  ✅ testCollectsEventsUntilFlush
  ✅ testFlushesCollectedEvents
  ✅ testSubscriberCanBeRegistered
  ✅ testTracerCanBeRegistered

 PHPUnit\Event\DirectDispatcherTest

PHPUnit.Event.DirectDispatcherTest
  ✅ testDispatchesEventToKnownSubscribers
  ✅ testDispatchesEventToTracers
  ✅ testRegisterRejectsUnknownSubscriber
  ✅ testDispatchRejectsUnknownEventType