https://bugzilla.wikimedia.org/show_bug.cgi?id=29612
Web browser: --- Bug #: 29612 Summary: Investigate why tests run setUp() and tearDown() more than once Product: MediaWiki Version: unspecified Platform: All OS/Version: All Status: NEW Severity: normal Priority: Unprioritized Component: Unit tests AssignedTo: innocentkil...@gmail.com ReportedBy: innocentkil...@gmail.com CC: m...@everybody.org Classification: Unclassified In some circumstances (at least: make test and using --filter), the test objects are constructed/destructed more than once. This seems unnecessary and leads to issues like the long-standing BlockTest failures that we finally worked around. Couple of points: 1) This doesn't happen all the time. Running a test directly via ./phpunit.php path/to/test.php doesn't seem to trigger the multiple construction issue. 2) It becomes really cumbersome in setUp() and tearDown() to ensure we're beginning with a sane test environment [and leaving a clean one for any subsequent tests]. 3) This may be related to deeper architectural issues in MediaWiki - I know for example the flipping of $wgDBprefix during setUp() is very finicky and I've broken it a lot of times. We may be making some incorrect assumptions about global states while working from a CLI environment...I know phpunit doesn't like globals very much. Cf: bug 9968, bug 23307 and a dozen others. 4) This may be rooted in "how phpunit does things," which ties into #3 above. We may just be trying to test a setup that phpunit isn't designed to test. 5) This is definitely not DBMS-specific. I've experienced the issue on both Mysql and Sqlite. I've done some profiling and nothing immediate has stood out at me. This may end up being a tracker bug for various other issues as I uncover them, but I just wanted to get my initial observations down in case anyone else was feeling adventurous. -- Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug. _______________________________________________ Wikibugs-l mailing list Wikibugs-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikibugs-l