1
0
mirror of https://github.com/danog/phpseclib.git synced 2024-12-02 09:38:06 +01:00

CS adjustments

This commit is contained in:
terrafrost 2023-03-04 20:47:49 -06:00
parent 530f8ab210
commit 71b9b64203
2 changed files with 23 additions and 2 deletions

View File

@ -2664,6 +2664,16 @@ class SSH2
throw new ConnectionClosedException('Unexpected response to publickey authentication pt 2'); throw new ConnectionClosedException('Unexpected response to publickey authentication pt 2');
} }
/**
* Return the currently configured timeout
*
* @return int
*/
public function getTimeout()
{
return $this->timeout;
}
/** /**
* Set Timeout * Set Timeout
* *

View File

@ -8,6 +8,7 @@
namespace phpseclib3\Tests\Unit\Net; namespace phpseclib3\Tests\Unit\Net;
use phpseclib3\Net\SSH2;
use phpseclib3\Tests\PhpseclibTestCase; use phpseclib3\Tests\PhpseclibTestCase;
class SSH2UnitTest extends PhpseclibTestCase class SSH2UnitTest extends PhpseclibTestCase
@ -135,16 +136,26 @@ class SSH2UnitTest extends PhpseclibTestCase
public function testGetConnectionByResourceId() public function testGetConnectionByResourceId()
{ {
$ssh = new \phpseclib3\Net\SSH2('localhost'); $ssh = new SSH2('localhost');
$this->assertSame($ssh, \phpseclib3\Net\SSH2::getConnectionByResourceId($ssh->getResourceId())); $this->assertSame($ssh, \phpseclib3\Net\SSH2::getConnectionByResourceId($ssh->getResourceId()));
} }
public function testGetResourceId() public function testGetResourceId()
{ {
$ssh = new \phpseclib3\Net\SSH2('localhost'); $ssh = new SSH2('localhost');
$this->assertSame('{' . spl_object_hash($ssh) . '}', $ssh->getResourceId()); $this->assertSame('{' . spl_object_hash($ssh) . '}', $ssh->getResourceId());
} }
public function testGetTimeout()
{
$ssh = new SSH2('localhost');
$this->assertEquals(10, $ssh->getTimeout());
$ssh->setTimeout(0);
$this->assertEquals(0, $ssh->getTimeout());
$ssh->setTimeout(20);
$this->assertEquals(20, $ssh->getTimeout());
}
/** /**
* @return \phpseclib3\Net\SSH2 * @return \phpseclib3\Net\SSH2
*/ */