jenkins-bot has submitted this change and it was merged.

Change subject: Remove Database clone call from DatabaseTests.php
......................................................................


Remove Database clone call from DatabaseTests.php

Change-Id: I60a22de9ccc7253abc9bbefe2a4f38675655ee4f
---
M includes/libs/rdbms/database/Database.php
M tests/phpunit/includes/db/DatabaseTest.php
2 files changed, 17 insertions(+), 15 deletions(-)

Approvals:
  Legoktm: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/libs/rdbms/database/Database.php 
b/includes/libs/rdbms/database/Database.php
index deaa396..9993277 100644
--- a/includes/libs/rdbms/database/Database.php
+++ b/includes/libs/rdbms/database/Database.php
@@ -3525,7 +3525,7 @@
         * @throws DBConnectionError
         */
        public function __clone() {
-               $this->connLogger->debug(
+               $this->connLogger->warning(
                        "Cloning " . get_class( $this ) . " is not recomended; 
forking connection:\n" .
                        ( new RuntimeException() )->getTraceAsString()
                );
diff --git a/tests/phpunit/includes/db/DatabaseTest.php 
b/tests/phpunit/includes/db/DatabaseTest.php
index 846509c..48dc332 100644
--- a/tests/phpunit/includes/db/DatabaseTest.php
+++ b/tests/phpunit/includes/db/DatabaseTest.php
@@ -359,24 +359,26 @@
                $origTrx = $db->getFlag( DBO_TRX );
                $origSsl = $db->getFlag( DBO_SSL );
 
-               if ( $origTrx ) {
-                       $db->clearFlag( DBO_TRX, $db::REMEMBER_PRIOR );
-               } else {
-                       $db->setFlag( DBO_TRX, $db::REMEMBER_PRIOR );
-               }
+               $origTrx
+                       ? $db->clearFlag( DBO_TRX, $db::REMEMBER_PRIOR )
+                       : $db->setFlag( DBO_TRX, $db::REMEMBER_PRIOR );
                $this->assertEquals( !$origTrx, $db->getFlag( DBO_TRX ) );
 
-               if ( $origSsl ) {
-                       $db->clearFlag( DBO_SSL, $db::REMEMBER_PRIOR );
-               } else {
-                       $db->setFlag( DBO_SSL, $db::REMEMBER_PRIOR );
-               }
+               $origSsl
+                       ? $db->clearFlag( DBO_SSL, $db::REMEMBER_PRIOR )
+                       : $db->setFlag( DBO_SSL, $db::REMEMBER_PRIOR );
                $this->assertEquals( !$origSsl, $db->getFlag( DBO_SSL ) );
 
-               $db2 = clone $db;
-               $db2->restoreFlags( $db::RESTORE_INITIAL );
-               $this->assertEquals( $origTrx, $db2->getFlag( DBO_TRX ) );
-               $this->assertEquals( $origSsl, $db2->getFlag( DBO_SSL ) );
+               $db->restoreFlags( $db::RESTORE_INITIAL );
+               $this->assertEquals( $origTrx, $db->getFlag( DBO_TRX ) );
+               $this->assertEquals( $origSsl, $db->getFlag( DBO_SSL ) );
+
+               $origTrx
+                       ? $db->clearFlag( DBO_TRX, $db::REMEMBER_PRIOR )
+                       : $db->setFlag( DBO_TRX, $db::REMEMBER_PRIOR );
+               $origSsl
+                       ? $db->clearFlag( DBO_SSL, $db::REMEMBER_PRIOR )
+                       : $db->setFlag( DBO_SSL, $db::REMEMBER_PRIOR );
 
                $db->restoreFlags();
                $this->assertEquals( $origSsl, $db->getFlag( DBO_SSL ) );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I60a22de9ccc7253abc9bbefe2a4f38675655ee4f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <asch...@wikimedia.org>
Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to