Dom icon indicating copy to clipboard operation
Dom copied to clipboard

Facade: Race condition in unit test

Open g105b opened this issue 3 years ago • 0 comments

I'm really confused by this one... I have to add @runsInSeparateProcess to a single test for it to pass.

https://github.com/PhpGt/Dom/pull/266/commits/e2f3996d9fdb50becfb8368b5551db0d76b76ead#diff-1aa40be7fe3508e1363a22df7f7ad5cc4ff33265966e25e059ade2683abe1d52R430

Without this, the test fails on this line: https://github.com/PhpGt/Dom/blob/e2f3996d9fdb50becfb8368b5551db0d76b76ead/src/Facade/DOMDocumentFacade.php#L263

The error is that gtDocument is not defined yet - but this is the first thing set in the constructor, so I can't see how it can't be defined. Also, if I run the whole test case with xdebug enabled, everything passes. This indicates to me that it's a race condition - maybe some shared memory in DOM or something like that?

All round, very confusing.

g105b avatar Apr 25 '21 11:04 g105b