Commit 070843e
committed
minor symfony#61601 [DependencyInjection] Add test case to ensure XML parse exception message includes filename and position (xersion22)
This PR was squashed before being merged into the 6.4 branch.
Discussion
----------
[DependencyInjection] Add test case to ensure XML parse exception message includes filename and position
| Q | A
| ------------- | ---
| Branch? | 6.4
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Issues | Fix symfony#61572
| License | MIT
## Summary
This PR adds a dedicated test to `XmlFileLoaderTest` to ensure that XML parse exceptions include the filename, error details, and position (line and column) in their messages.
## What it does and why it's needed
- Ensures error messages from XML parse exceptions always contain:
- The XML filename (e.g., `services31.xml`)
- The error details (e.g., "This element is not expected")
- The position (line X, column Y)
- Prevents regressions by automatically checking this behavior in tests
- Improves consistency and debuggability of XML parsing errors
## Example
When an invalid XML file (such as `services31.xml`) is loaded, the exception message will now contain:
- The filename: `services31.xml`
- The error detail: "This element is not expected"
- The position: `line X, column Y`
Commits
-------
d6fdc90 [DependencyInjection] Add test case to ensure XML parse exception message includes filename and positionFile tree
2 files changed
+24
-0
lines changed- src/Symfony/Component/DependencyInjection/Tests
- Fixtures/xml
- Loader
2 files changed
+24
-0
lines changedLines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1286 | 1286 | | |
1287 | 1287 | | |
1288 | 1288 | | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
1289 | 1305 | | |
0 commit comments