Merge branch 'rposky'

This commit is contained in:
terrafrost 2023-03-04 21:00:14 -06:00
commit 9a356ba200
2 changed files with 20 additions and 0 deletions

View File

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

View File

@ -143,6 +143,16 @@ class SSH2UnitTest extends PhpseclibTestCase
$this->assertSame('{' . spl_object_hash($ssh) . '}', $ssh->getResourceId());
}
public function testGetTimeout(): void
{
$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());
}
/**
*/
protected function createSSHMock(): SSH2