diff options
author | Ori Livneh <ori@wikimedia.org> | 2016-05-14 22:09:13 -0700 |
---|---|---|
committer | Ori Livneh <ori@wikimedia.org> | 2016-05-18 02:23:26 -0700 |
commit | 66afa6ecd0d9cd4711bdf7a87152fc1ed03edf90 (patch) | |
tree | 24312d9b2152e5fdada589f99f60e7ddefdbc01f /includes/debug | |
parent | 33cb9e803ae020917bcc073e1599d2fdfbfb04c2 (diff) | |
download | mediawikicore-66afa6ecd0d9cd4711bdf7a87152fc1ed03edf90.tar.gz mediawikicore-66afa6ecd0d9cd4711bdf7a87152fc1ed03edf90.zip |
MWDebugTest: disable MWDebug on test teardown
MWDebug::init() is currently irreversible -- once MWDebug is enabled, it cannot
be disabled in that execution context. This means that the MWDebug test suite
(which enables MWDebug) has a nasty side-effect -- all the tests that run after
it run with MWDebug enabled. So add an MWDebug::deinit(), and call it on test
teardown.
Ostensibly this is a great use-case for services and dependency injection. The
reason I am not going that route is that it's not entirely clear to me what the
MWDebug class is supposed to represent. If I were going to spend any
substantial amount of time on this, I would be trying to move it out of core
and into an extension, not converting it into a service.
Change-Id: I52c511be049bc276d203d07283e3aa0944f22d34
Diffstat (limited to 'includes/debug')
-rw-r--r-- | includes/debug/MWDebug.php | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/includes/debug/MWDebug.php b/includes/debug/MWDebug.php index 13d25a86b426..d90ef8a7d18c 100644 --- a/includes/debug/MWDebug.php +++ b/includes/debug/MWDebug.php @@ -76,6 +76,15 @@ class MWDebug { } /** + * Disable the debugger. + * + * @since 1.28 + */ + public static function deinit() { + self::$enabled = false; + } + + /** * Add ResourceLoader modules to the OutputPage object if debugging is * enabled. * |