mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-11-16 10:15:14 +00:00
Add a functional test case for SSH2 login using Agent.
This commit is contained in:
parent
1c949e47c8
commit
9672b31af0
31
tests/Functional/Net/SSH2AgentTest.php
Normal file
31
tests/Functional/Net/SSH2AgentTest.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @author Andreas Fischer <bantu@phpbb.com>
|
||||
* @copyright 2014 Andreas Fischer
|
||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||
*/
|
||||
|
||||
class Functional_Net_SSH2AgentTest extends PhpseclibFunctionalTestCase
|
||||
{
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
if (!isset($_SERVER['SSH_AUTH_SOCK'])) {
|
||||
self::markTestSkipped(
|
||||
'This test requires an SSH Agent (SSH_AUTH_SOCK env variable).'
|
||||
);
|
||||
}
|
||||
parent::setUpBeforeClass();
|
||||
}
|
||||
|
||||
public function testAgentLogin()
|
||||
{
|
||||
$ssh = new Net_SSH2($this->getEnv('SSH_HOSTNAME'));
|
||||
$agent = new System_SSH_Agent;
|
||||
|
||||
$this->assertTrue(
|
||||
$ssh->login($this->getEnv('SSH_USERNAME'), $agent),
|
||||
'SSH2 login using Agent failed.'
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user