Ejegg has uploaded a new change for review.

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

Change subject: Fix DamagedDb::storeMessage return value
......................................................................

Fix DamagedDb::storeMessage return value

Lost in the prepareAndExecute refactor, useful for failmail links.

Change-Id: I74a795e8717d73387de36182e2081acee9188bbe
---
M Core/DataStores/DamagedDatabase.php
M Tests/DamagedDatabaseTest.php
2 files changed, 4 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/73/317273/1

diff --git a/Core/DataStores/DamagedDatabase.php 
b/Core/DataStores/DamagedDatabase.php
index 8f6e60a..19d6b3a 100644
--- a/Core/DataStores/DamagedDatabase.php
+++ b/Core/DataStores/DamagedDatabase.php
@@ -66,6 +66,8 @@
                        VALUES ( $paramList );";
 
                $this->prepareAndExecute( $insert, $dbRecord );
+
+               return $this->getDatabase()->lastInsertId();
        }
 
        /**
diff --git a/Tests/DamagedDatabaseTest.php b/Tests/DamagedDatabaseTest.php
index db03227..c373e9e 100644
--- a/Tests/DamagedDatabaseTest.php
+++ b/Tests/DamagedDatabaseTest.php
@@ -52,7 +52,7 @@
                $err = 'ERROR MESSAGE';
                $trace = "Foo.php line 25\nBar.php line 99";
 
-               $this->db->storeMessage( $message, $queue, $err, $trace );
+               $damagedId = $this->db->storeMessage( $message, $queue, $err, 
$trace );
 
                // Confirm work without using the API.
                $pdo = $this->db->getDatabase();
@@ -64,7 +64,7 @@
                $this->assertEquals( 1, count( $rows ),
                        'One row stored and retrieved.' );
                $expected = array(
-                       'id' => '1',
+                       'id' => $damagedId,
                        # NOTE: This is a db-specific string, sqlite3 in this 
case, and
                        # you'll have different formatting if using any other 
database.
                        'original_date' => '20160720001408',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I74a795e8717d73387de36182e2081acee9188bbe
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/SmashPig
Gerrit-Branch: master
Gerrit-Owner: Ejegg <eeggles...@wikimedia.org>

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

Reply via email to