Hello Krinkle, Hashar,

I'd like you to do a code review.  Please visit

    https://gerrit.wikimedia.org/r/289367

to review the following change.

Change subject: MWDebugTest: disable MWDebug on test teardown
......................................................................

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
---
M includes/debug/MWDebug.php
M tests/phpunit/includes/debug/MWDebugTest.php
2 files changed, 10 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/67/289367/1

diff --git a/includes/debug/MWDebug.php b/includes/debug/MWDebug.php
index 13d25a8..d90ef8a 100644
--- a/includes/debug/MWDebug.php
+++ b/includes/debug/MWDebug.php
@@ -76,6 +76,15 @@
        }
 
        /**
+        * Disable the debugger.
+        *
+        * @since 1.28
+        */
+       public static function deinit() {
+               self::$enabled = false;
+       }
+
+       /**
         * Add ResourceLoader modules to the OutputPage object if debugging is
         * enabled.
         *
diff --git a/tests/phpunit/includes/debug/MWDebugTest.php 
b/tests/phpunit/includes/debug/MWDebugTest.php
index 9c2bc75..e659af4 100644
--- a/tests/phpunit/includes/debug/MWDebugTest.php
+++ b/tests/phpunit/includes/debug/MWDebugTest.php
@@ -17,6 +17,7 @@
 
        protected function tearDown() {
                MediaWiki\restoreWarnings();
+               MWDebug::deinit();
                parent::tearDown();
        }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/289367
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I52c511be049bc276d203d07283e3aa0944f22d34
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to