Skip to content

Commit

Permalink
CS adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
terrafrost committed Mar 5, 2023
1 parent 530f8ab commit 71b9b64
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
10 changes: 10 additions & 0 deletions phpseclib/Net/SSH2.php
Original file line number Diff line number Diff line change
Expand Up @@ -2664,6 +2664,16 @@ private function privatekey_login($username, PrivateKey $privatekey)
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
*
Expand Down
15 changes: 13 additions & 2 deletions tests/Unit/Net/SSH2UnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

namespace phpseclib3\Tests\Unit\Net;

use phpseclib3\Net\SSH2;
use phpseclib3\Tests\PhpseclibTestCase;

class SSH2UnitTest extends PhpseclibTestCase
Expand Down Expand Up @@ -135,16 +136,26 @@ public function testEnableQuietMode()

public function testGetConnectionByResourceId()
{
$ssh = new \phpseclib3\Net\SSH2('localhost');
$ssh = new SSH2('localhost');
$this->assertSame($ssh, \phpseclib3\Net\SSH2::getConnectionByResourceId($ssh->getResourceId()));
}

public function testGetResourceId()
{
$ssh = new \phpseclib3\Net\SSH2('localhost');
$ssh = new SSH2('localhost');
$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
*/
Expand Down

0 comments on commit 71b9b64

Please sign in to comment.