From: Umherirrender Date: Sun, 30 Sep 2018 15:14:16 +0000 (+0200) Subject: Fix caller name in DatabasePostgresTest X-Git-Tag: 1.34.0-rc.0~3945 X-Git-Url: http://git.heureux-cyclage.org/?a=commitdiff_plain;h=6fc9cf4f6450d3e58aa817ee34941d04b05a9783;p=lhc%2Fweb%2Fwiklou.git Fix caller name in DatabasePostgresTest Seeing {closure} in the logs as caller is not helpful Also add some missing caller name, which avoids Database::query as caller in the logs Change-Id: I3cab186cd63b295d1e4d1ca5232bc81925a85eb0 --- diff --git a/tests/phpunit/includes/db/DatabasePostgresTest.php b/tests/phpunit/includes/db/DatabasePostgresTest.php index 5c2aa2bb2c..6b1ed7fa21 100644 --- a/tests/phpunit/includes/db/DatabasePostgresTest.php +++ b/tests/phpunit/includes/db/DatabasePostgresTest.php @@ -11,15 +11,17 @@ use Wikimedia\TestingAccessWrapper; class DatabasePostgresTest extends MediaWikiTestCase { private function doTestInsertIgnore() { - $reset = new ScopedCallback( function () { + $fname = __METHOD__; + $reset = new ScopedCallback( function () use ( $fname ) { if ( $this->db->explicitTrxActive() ) { - $this->db->rollback( __METHOD__ ); + $this->db->rollback( $fname ); } - $this->db->query( 'DROP TABLE IF EXISTS ' . $this->db->tableName( 'foo' ) ); + $this->db->query( 'DROP TABLE IF EXISTS ' . $this->db->tableName( 'foo' ), $fname ); } ); $this->db->query( - "CREATE TEMPORARY TABLE {$this->db->tableName( 'foo' )} (i INTEGER NOT NULL PRIMARY KEY)" + "CREATE TEMPORARY TABLE {$this->db->tableName( 'foo' )} (i INTEGER NOT NULL PRIMARY KEY)", + __METHOD__ ); $this->db->insert( 'foo', [ [ 'i' => 1 ], [ 'i' => 2 ] ], __METHOD__ ); @@ -92,19 +94,22 @@ class DatabasePostgresTest extends MediaWikiTestCase { } private function doTestInsertSelectIgnore() { - $reset = new ScopedCallback( function () { + $fname = __METHOD__; + $reset = new ScopedCallback( function () use ( $fname ) { if ( $this->db->explicitTrxActive() ) { - $this->db->rollback( __METHOD__ ); + $this->db->rollback( $fname ); } - $this->db->query( 'DROP TABLE IF EXISTS ' . $this->db->tableName( 'foo' ) ); - $this->db->query( 'DROP TABLE IF EXISTS ' . $this->db->tableName( 'bar' ) ); + $this->db->query( 'DROP TABLE IF EXISTS ' . $this->db->tableName( 'foo' ), $fname ); + $this->db->query( 'DROP TABLE IF EXISTS ' . $this->db->tableName( 'bar' ), $fname ); } ); $this->db->query( - "CREATE TEMPORARY TABLE {$this->db->tableName( 'foo' )} (i INTEGER)" + "CREATE TEMPORARY TABLE {$this->db->tableName( 'foo' )} (i INTEGER)", + __METHOD__ ); $this->db->query( - "CREATE TEMPORARY TABLE {$this->db->tableName( 'bar' )} (i INTEGER NOT NULL PRIMARY KEY)" + "CREATE TEMPORARY TABLE {$this->db->tableName( 'bar' )} (i INTEGER NOT NULL PRIMARY KEY)", + __METHOD__ ); $this->db->insert( 'bar', [ [ 'i' => 1 ], [ 'i' => 2 ] ], __METHOD__ );