~ubuntu-branches/ubuntu/trusty/php-horde-crypt/trusty

« back to all changes in this revision

Viewing changes to Horde_Crypt-2.1.3/test/Horde/Crypt/PgpKeyserverTest.php

  • Committer: Package Import Robot
  • Author(s): Mathieu Parent
  • Date: 2013-04-07 15:44:20 UTC
  • mfrom: (1.1.3)
  • Revision ID: package-import@ubuntu.com-20130407154420-c39qgb7itdsbv373
Tags: 2.1.3-1
New upstream version 2.1.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/**
 
3
 * Horde_Crypt_Pgp tests involving the keyserver.
 
4
 *
 
5
 * @author     Michael Slusarz <slusarz@horde.org>
 
6
 * @category   Horde
 
7
 * @license    http://www.horde.org/licenses/lgpl21 LGPL 2.1
 
8
 * @package    Crypt
 
9
 * @subpackage UnitTests
 
10
 */
 
11
 
 
12
class Horde_Crypt_PgpKeyserverTest extends Horde_Test_Case
 
13
{
 
14
    protected $_pgp;
 
15
 
 
16
    protected function setUp()
 
17
    {
 
18
        $config = self::getConfig('CRYPT_TEST_CONFIG');
 
19
        if (!$config || empty($config['crypt']['keyserver'])) {
 
20
            $this->markTestSkipped('Keyserver test has not been enabled.');
 
21
        }
 
22
 
 
23
        if (!is_executable('/usr/bin/gpg')) {
 
24
            $this->markTestSkipped('GPG binary not found at /usr/bin/gpg.');
 
25
        }
 
26
 
 
27
        $this->_pgp = Horde_Crypt::factory('Pgp', array(
 
28
            'program' => '/usr/bin/gpg',
 
29
            'temp' => sys_get_temp_dir()
 
30
        ));
 
31
    }
 
32
 
 
33
    public function testKeyserverRetrieve()
 
34
    {
 
35
        $this->_pgp->getPublicKeyserver('4DE5B969');
 
36
    }
 
37
 
 
38
    public function testKeyserverRetrieveByEmail()
 
39
    {
 
40
        $this->assertEquals(
 
41
            '4DE5B969',
 
42
            $this->_pgp->getKeyID('jan@horde.org')
 
43
        );
 
44
    }
 
45
 
 
46
}