Description: Update tests for gnupg2 changes
 The tests currently rely on gnupg1 formatted outputs, so pass
parameters to gnupg that . Additionally, it
 seems some new parameters are needed to get batch behavior correctly.
 Thanks to https://github.com/keybase/keybase-issues/issues/1712 for
 related, but not identical, issues and solution suggestions.
 .
 Split testVerifyPassphrase() into two tests so the agent caching from
 gpg2 does not lead to a false negative.
Author: Nishanth Aravamudan <nish.aravamudan@canonical.com>
Bug-Ubuntu: https://launchpad.net/bugs/1652133
Last-Update: 2016-12-22

--- a/Horde_Crypt-2.7.5/lib/Horde/Crypt/Pgp/Backend/Binary.php
+++ b/Horde_Crypt-2.7.5/lib/Horde/Crypt/Pgp/Backend/Binary.php
@@ -75,8 +75,15 @@
             '--no-options',
             '--no-default-keyring',
             '--yes',
-            '--homedir ' . $this->_tempdir
+            '--homedir ' . $this->_tempdir,
+            '--keyid-format short'
         );
+
+        $result = $this->_callGpg(array('--version'), 'r', null, false, false, true);
+        /* gpg > 1.x requires specifying the pinentry-mode */
+        if (!preg_match('/gpg \(GnuPG\) = (1\.[0-9\.]+)/', $result->stdout, $m)) {
+           $this->_gnupg[] = '--pinentry-mode loopback';
+        }
     }
 
     /**
@@ -678,6 +685,7 @@
         if ($parseable) {
             putenv('LANGUAGE=C');
         }
+        putenv('GPG_TTY=$(tty)');
         if ($mode == 'w') {
             if ($fp = popen($cmdline, 'w')) {
                 putenv('LANGUAGE=' . $language);
--- a/Horde_Crypt-2.7.5/test/Horde/Crypt/Pgp/TestBase.php
+++ b/Horde_Crypt-2.7.5/test/Horde/Crypt/Pgp/TestBase.php
@@ -511,7 +511,7 @@
         $this->assertNotEmpty($out->result);
     }
 
-    public function testVerifyPassphrase()
+    public function testVerifyPassphraseCorrect()
     {
         $this->assertTrue(
             $this->_pgp->verifyPassphrase(
@@ -520,7 +520,10 @@
                 'Secret'
             )
         );
+    }
 
+    public function testVerifyPassphraseIncorrect()
+    {
         $this->assertFalse(
             $this->_pgp->verifyPassphrase(
                 $this->_getPublicKey(),